XAMPP & Fake SendMail For Windows
Setelah kemarin bermain-main dengan membuat aplikasi konfirmasi pembayaran. gw memikirkan untuk hal recovery password. Tetapi seperti biasa, karena ini adalah localhost, maka ga bisa semudah itu melakukan send email, kecuali komputer gw adalah komputer web server asli yang memiliki mail server juga.
Secara biasa, mustahil memang melakukan halnya menggunakan fungsi mail. apabila kita meng-execute fungsi “mail” yang terjadi ga lain adalah error messege dari PHP:
Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in H:\xampplite\htdocs\inet\_doSendEmail.php on line 67
Semua ini ga lain karena PHP tidak menyediakan langsung mail server. Terlebih dalam versi Windowsnya, tidak bisa dilakukan langsung(Well begitu pula dalam lingkungan asalnya uga demikian).
Seketika mengingat-ingat kembali, seingat gw memang XAMPP lite juga menyediakan fake sendmail for Windows, yang sampai saat ini gw ga pernah utak atik. Penasaranpun muncul dari hati semenjak bangun pagi tadi pukul 05.00 dan ga sabar akhirnya gw bangun untuk mencari bagaimana menggunakannya. Karena selama ini tanpa diseeting dahulu tidak akan pernah bisa jalan, dan pernah sesekali gw melihat settingnya tapi belom pernah gw pakai.
Setelah beberapa lama, mencari referensi juga, terutama sekaligus dengan contohnya. Akhirnya kebetulan juga menemukan cara menyetting SEND Mail dengan GMail.
FYI :
Fake Send Mail for Windows membutuhkan mail server yang memiliki fasilitas SMTP sehingga mail yang tidak mengijinkan menggunakan SMTP tidak bisa digunakan(seperti Yahoo! mail yanginternasional [berdomain ".com" saja yang tidak diikuti regional domain]). Apabila memiliki domain hosting APAChe biasanya mengijinkan akses SMTP atau salah satu yang gw pakai sebagai contoh disini adalah GMail, layanan email dari Google(Semenjak beberapa tahun lalu, pendaftaran GMail sudah dibebaskan sehingga kalayak umum bisa mendaftar secara bebas).
Yang dibutuhkan adalah:
- Fake SendMail for Windows(here or here for creator website)
- OPTIONAL : Sendmail SSL(here or ada juga di halaman download Sendmail di webnya)
Untuk item nomor 2, dibutuhkan apabila SMTP membutuhkan Secrure Connection(SSL/TSL). Dalam case ini, GMail menggunakanTSL, sehingga mau tak mau package ini ahrus gw tambahkan ke dalam package Sendmail yang sudah ada(Cukup Unzip pada directory yang sama dengan directory ‘sendmail‘).
Dalam semua paket XAMPP, Sendmail sudah disediakan(cuma ga ada SSL/TSL supportnya, download dan tambahkan sendiri). versi yang gw pakai adalah XAMPP Lite 1.7.0 . Gw menggunakan versi LITE sudah cukup lama dengan alasan fleksibel dan mudah dipindahkan dari drive ke Drive tanpa harus installasi, dan gw pun bisa membawanya di dalam FDD(Flash Disk Drive) dan menggunakannya dimanapun di PC berbasis Windows.
Dalam Folder Sendmail sudah terdapat beberapa file(kecuali 2 library tambahan untuk SSL dan TSL)
Extract dan Taruh 2 File library tambahan untuk SSL/TSL yang sudah di download ke dalam folder ini:
Kemudian Bukalah file “sendmail.ini“, dengan “Notepad” atau dengan text editor seperti “Notepad++”. isi Defaultnya akan kurang lebih seperti ini:
; configuration for fake sendmail
; if this file doesn’t exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail[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=mail.mydomain.com
; 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 modifydefault_domain=mydomain.com
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable loggingerror_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=
auth_password=; if your smtp server uses pop3 before smtp authentication, modify the
; following three linespop3_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 contentforce_sender=
; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if requiredhostname=
Kita butuh mengubah beberapa bagian disini:
; configuration for fake sendmail
; if this file doesn’t exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail[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=smtp.gmail.com
; smtp port (normally 25)
smtp_port=587
; 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 modifydefault_domain=yourdomain.com
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable loggingerror_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=[usernameGmail tanpa "@gmail.com"]
auth_password=[Your Password]; if your smtp server uses pop3 before smtp authentication, modify the
; following three linespop3_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 contentforce_sender=testing_mine@xampp-localhost.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=localhost
- Hijau : harus dirubah
- Biru : Optional
- Merah : Isi sesuai kebutuhan
Save dan tutup file tersebut. Kalau kita jalankan sekarang, error tetap masih ada karena config dari PHP masih belum disetting secra default dari XAMPP, jadi masih ada kerjaan lain yang harus diselesaikan.
Carilah file “php.ini” di dalam folder “xampplite\apache\bin\“(yang dipakai adalah “php.ini” yang ada di folder ini, bukan di folder “php“) cari Line yang berisi kuarng lebih:
[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 = “\xampplite\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 =
Disekitar line 695, pada line:
;sendmail_path = “\xampplite\sendmail\sendmail.exe -t”
hilangkan tanda titik koma”;” di awal baris menjadi :
sendmail_path = “\xampplite\sendmail\sendmail.exe -t”
Save dan tutup file ‘php.ini’. kemudian restart Apache dan cobalah execute script sendmail. Apabila opsi:
;debug_logfile=debug.log
Diaktifkan(dihilangkan tanda “;” di awal barisnya), maka proses yang dilakukan akan tertulis dalam file “debug.log” pada folder sendmail, sehingga kita bisa melihat data history sendmail.
Setelah melakukan ini semua, email bisa ter-send dari localhost melalui mail server GMail … akhirnya bisa test fungsi mail dari localhost ![]()
PS: Tutorial/cara ini tidak berjalan di XAMPP 1.7.2 … gw masih mencoba mencari jalan keluarnya.. .![]()
Popularity: 24% [?]
4 Responses to XAMPP & Fake SendMail For Windows
Leave a Reply Cancel reply
This Blog
My name is Rizky Gunawan, graduated(Waw, thanks God I can graduated :P ) from Computer Science Major. My Hobby is Coding, and my speciality is web development using PHP. Currently I'm working on some press company in Indonesia as Internal Software Developer.
Tags
ajax AMD AMD HSF Anime Anime Music Ar tonelico ATI Clannad core i5 Crysis GeForce Gigabyte hymmnos Intel Intel HSF javascript K-ON Kosaka Kirino Linux Microsoft Motherboard MSI Music Video mySQl Nvidia ONKYO Overclocking P55 PC Games Phenom II X4 php Project Skripsi Soundcard Thermalright thermalright Ultra 120 Extreme Touhou Ubuntu VGA Card Warhead Web Design web project Windows Windows 7 Wordpress ThemeReent Comment
Archives



turorialnya bagus nih bro ,tapi apa cuman pakek xampp yang versi 1.7.0 aja ya ???
pesan errornya gini…
SSL is not available on this server. ….
SSL download dmn ya? atau menggunakan openssl ?
kan ada di webnya kan? webnya si fakeSendmail? saya dapetnya juga dari sana