
Dalam membuat website mungkin diantara kita pernah mendapati pesan error php etika menjalankan fungsi mail() pada localhost.
Untuk bisa melakukan pengiriman email menggunakan fungsi mail() php maka perlu beberapa konfigurasi yng harus di ubah pada file php.ini
dan demi kelancaran dan keselamatan email yang dikirim, kita dapat menggunakan SMTP Google. (biar email gak dianggep spam getoo,,)

Ok, yang harus dipersiapkan antara lain adalah:
1. Download Fake sendmail karya Byron Jones (jika belum punya) disini atau disini
2. Download stunnel (jika belum punya) disini
Langkah - langkah:
0. Jika belum punya akun gmail atau google apps, silahkan daftar dulu
1. Pertamax2, extract file fake sendmail .zip pada hardisk anda, taroh aja di C:\sendmail
2. Buka file php.ini dengan notepad (plus plus lebih baik), (path C:\WINDOWS\php.ini )
3. Edit file php.ini pada baris beriikut: (perhatikan text warna merah)
Code:
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\sendmail\sendmail.exe -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
lakukan perubahan seperti berikut: (merah: sesuai akun anda)
Code:
[sendmail] ; you must change mail.mydomain.com to your smtp server, ; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup) ; emails delivered via IIS's pickup directory cause sendmail to ; run quicker, but you won't get error messages back to the calling ; application. smtp_server=localhost ; smtp port (normally 25) smtp_port=25 ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify ;jika gak pake google apps: default_domain=gmail.com ; log smtp errors to error.log (defaults to same directory as sendmail.exe) ; uncomment to enable logging error_logfile=error.log ; create debug log as debug.log (defaults to same directory as sendmail.exe) ; uncomment to enable debugging ;debug_logfile=debug.log ; if your smtp server requires authentication, modify the following two lines auth_username=webmaster@gmail.com auth_password=password ; if your smtp server uses pop3 before smtp authentication, modify the ; following three lines ;pop3_server= ;pop3_username= ;pop3_password= ; to force the sender to always be the following email address, uncomment and ; populate with a valid email address. this will only affect the "MAIL FROM" ; command, it won't modify the "From: " header of the message content force_sender=webmaster@gmail.com ; sendmail will use your hostname and your default_domain in the ehlo/helo ; smtp greeting. you can manually set the ehlo/helo name if required ;hostname=
Ok, silahkan install stunnel yang udah di download.
6. kalo Udah, Buka configurasinya, path: C:\Program Files\stunnel\stunnel.conf
Ubah menjadi seperti berikut: (prhatikan titik koma)
Code:
; Certificate/key is needed in server mode and optional in client mode ; The default certificate is provided only for testing and should not ; be used in a production environment cert = stunnel.pem ;key = stunnel.pem ; Some performance tunings socket = l:TCP_NODELAY=1 socket = r:TCP_NODELAY=1 ; Workaround for Eudora bug ;options = DONT_INSERT_EMPTY_FRAGMENTS ; Authentication stuff ;verify = 2 ; Don't forget to c_rehash CApath ;CApath = certs ; It's often easier to use CAfile ;CAfile = certs.pem ; Don't forget to c_rehash CRLpath ;CRLpath = crls ; Alternatively you can use CRLfile ;CRLfile = crls.pem ; Some debugging stuff useful for troubleshooting debug = 7 output = stunnel.log ; Use it for client mode client = yes ; Service-level configuration [pop3s] accept = 995 connect = 110 [imaps] accept = 993 connect = 143 [ssmtp] accept = 465 connect = 25 ;[https] ;accept = 443 ;connect = 80 ;TIMEOUTclose = 0 [smtpg] accept = 127.0.0.1:25 connect = smtp.gmail.com:465 ; vim:ft=dosini
ok,, sepertinya udah, dan restart komputernya.
lalu coba anda test script yang menggunakan fungsi mail() php
Sebenarnya ada cara lain yang lebih simple lagi, cuman saya nemunya belakangan, jadi belum nyoba
silahkan coba:
http://www.projectpier.org/node/817
buat yg pakai xampp, langkah 1-4 sepertinya nggak perlu coz udah ada fasilitas di xampp,, jadi tinggal konfigurasi stunnel nya doank