Mengirim Email Gmail Lewat LocalHost Menggunakan PHP dan SSMPT


Mengirim Email Gmail Lewat Localhost Menggunakan SSMPT dan PHP

Pertama Instal SSMPT

# apt-get install ssmtp

Kedua setting email account kita dengan menambahkan :

# nano /etc/ssmtp/ssmtp.conf
Tambahkan Lines ini:
root=user@gawab.com
mailhub=smtp.gawab.com:25
hostname=user@gawab.com
FromLineOverride=YES
AuthUser=emailku@gmail.com
AuthPass=xxxuserpassxxx

# nano /etc/ssmtp/revaliases Tambahkan Lines ini:
root:emailku@gmail.com:smtp.gmail.com:587
youruser:emailku@gmail.com:smtp.gmail.com:587

# gedit /etc/php5/apache2/php.ini
Rubah Line ini:
#sendmail_path =
 -rubah jadi :
sendmail_path = /usr/sbin/ssmtp -t

#service apache2 restart

Perintah untuk kirim Email Lewat Console

# ssmtp emailTujuan@gmail.com

To:emailTujuan@gmail.com
From:yoesoff@gmail.com
Subject: Ini Subject

<beri space enter>
ini adalah isi pesan
ctrl+d

Kode Php untuk kirim email via ssmpt pada Localhost

<?php
$to = “dirinya@kir******.com”;
$subject = “Test mail subject”;
$message = “Hello! This is a simple email message !”;
$from = “emailku@gmail.com”;
$headers = “From:” . $from;
mail($to,$subject,$message,$headers);
echo “Mail Sent.”;
?>

Tags: tutorial, tutorial email dari localhost, belajar kirim email dari localhost, tutorial ssmpt,Email Localhost, Mengirim Email dari Localhost, Localhost  Email, PHP Localhost Email, SSMPT PHP, SSMPT Localhost, localhost SSMPT

One thought on “Mengirim Email Gmail Lewat LocalHost Menggunakan PHP dan SSMPT

  1. ijin save page as Mengirim Email Gmail Lewat Localhost Menggunakan SSMPT dan PHP mas ,
    terimakasih banyak🙂
    salam programer, ari:)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s