Saturday, April 12, 2014

Send Email lewat localhost xampp tanpa buat domain



Kadang Web Programmer khususnya dibidang ecommerce yang transaksi datanya banyak menggunakan email sudah langsung terkirim email dengan function Mail(bla.., bla.., bla..) lewat provider yang sudah ada domainnya. Nah, bagaimana dengan Program Web Non ecommerce ? misalnya sistem informasi tagihan yang didalamnya terdapat keuangan atau yang lainnya?
Atau bisa juga kita mau mengetest kirim email di localhost laptop atau pc kita ? mungkin agak merepotkan kalau langsung dicoba dengan program kita yg sudah online diinternet (dikit-dikit copy paste ke cpanel).
Kalau setau ane, ada tools untuk menghandle ini, yaitu thunderbird atau mercury sebagai web server sehingga memudahkan kita untuk kirim email lewat localhost tanpa membuat domain terlebih dahulu.

 Tapi lewat blog ini ane akan menshare bagaimana mengirim email lewat localhost yang lebih mudah dan tidak repot-repot untuk install tools lg.
Yaitu dengan menggunakan SMTP gmail, SMTP default xampp kadang tidak jalan jika kita mengirim email.caranya anda tinggal download file zip sendmail berikut : sendmail.zip 
download, extract lalu letakkan foldernya di drive kesukaan anda, contoh kalau ane letakkan di drive C:\ , 
sehingga pathnya C:\sendmail\
Nah didalam folder sendmail, buka di editor anda sendmail.ini, lalu edit bagian sebagai berikut :
smtp_server=smtp.gmail.com

; smtp port (normally 25)



smtp_port=587



; SMTPS (SSL) support

;   auto = use SSL for port 465, otherwise try to use TLS

;   ssl  = alway use SSL

;   tls  = always use TLS

;   none = never try to use SSL



smtp_ssl=auto



; 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



;default_domain=mydomain.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=your_email@gmail.com            

auth_password=your_password



; if your smtp server uses pop3 before smtp authentication, modify the

; following three lines.  do not enable unless it is required.



pop3_server=

pop3_username=

pop3_password=



; force the sender to always be the following email address

; this will only affect the "MAIL FROM" command, it won't modify

; the "From: " header of the message content



force_sender=your_email@gmail.com



; force the sender to always be the following email address

; this will only affect the "RCTP TO" command, it won't modify

; the "To: " header of the message content



force_recipient=



; 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=
setelah disetting seperti diatas, buka file php.ini di xampp atau wamp atau yg lainnya lalu edit bagian berikut :
;sendmail_path = "\.\sendmail\sendmail.exe -t"
menjadi
sendmail_path = "C:\sendmail\sendmail.exe -t"
*titik komanya dihilangkan, path diatas sesuai file zip yang anda dicopykan di drive anda yg sudah ane jelaskan diatas.
Nah, hanya segitu maka ane jamin kirim email anda dari localhost akan jalan, tp syaratnya internet anda hrs nyala ya :D

Read more »