Skip to content

sendmail via gmail xampp

May 13, 2012

Hi All

setelah puasa berminggu-minggu tidak blogging, kali ini saya akan membahas mengenai send mail melalui sendmail via xampp

untuk mudahnya kita memakai sebagai smtp (send mail transfer protocol)

  • pertama-tama buka php.ini di xampp anda, dir : xampp/php/php.ini dan pastikan service sendmail jalan

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
; http://php.net/sendmail-path
sendmail_path = “\”C:\xampp\sendmail\sendmail.exe\” -t”

  • kemudian download sendmail yg terbaru dari sendmail website,.
  • backup semua file/folder yg berada di directory  sendmail xampp (dir = xampp/sendmail).
  • ekstrak sendmail yang sudah anda download ke dalam direktori sendmail tersebut.
  • konfigurasi sendmail.ini

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username=USERNAME@gmail.com  
auth_password=PASSWORD
force_sender=USERNAME@gmail.com

  • simpan file ‘
  • buat satu mail function dan simpan di htdocs/sendmailtest.php

<?php
$to = ‘mailtujuan@example.com’;
$subject = ‘test send mail’;
$message = ‘hello’;
$headers = ‘From: webmaster@example.com’ . “\r\n” .
‘Reply-To: webmaster@example.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();

mail($to, $subject, $message, $headers);
?>

  • start apache server
  • jalankan browser dan arahkan url ke http://localhost/sendmailtest.php
  • untuk menguji hasil tersebut, buka email anda apakah ada email masuk dengan subyek “test send mail”
Advertisements

From → Misc.

One Comment
  1. sangprabo permalink

    Wow.. Makasih tutorialnya Gan.. Oia gan, dicariin sama Bapa Stavol

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

%d bloggers like this: