0% found this document useful (0 votes)
306 views

Setting Wamp Server For Email Sending Through SSL

This document provides instructions for configuring sendmail.exe to allow PHP to send emails through SMTP on a Windows server. The steps include downloading sendmail.exe, extracting the necessary files to a sendmail folder, configuring sendmail.ini with SMTP server details, enabling IMAP in Gmail settings, enabling SSL and socket extensions in PHP, and modifying php.ini to specify the sendmail path for mail functions. A PHP test file is also provided to validate the configuration.

Uploaded by

shijinbgopal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
306 views

Setting Wamp Server For Email Sending Through SSL

This document provides instructions for configuring sendmail.exe to allow PHP to send emails through SMTP on a Windows server. The steps include downloading sendmail.exe, extracting the necessary files to a sendmail folder, configuring sendmail.ini with SMTP server details, enabling IMAP in Gmail settings, enabling SSL and socket extensions in PHP, and modifying php.ini to specify the sendmail path for mail functions. A PHP test file is also provided to validate the configuration.

Uploaded by

shijinbgopal
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

This solution requires sendmail.

exe (a Command Line Interface (CLI) executable which accepts email from PHP, connects to an SMTP server and sends email). You will not require to use it by command, dont bother about it Download the sendmail.zip and follow these steps:

Create a folder named sendmail in C:\wamp\. Extract these 4 files in sendmail folder: sendmail.exe, libeay32.dll, ssleay32.dll and sendmail.ini. Open the sendmail.ini file and configure it as following o smtp_server=smtp.gmail.com o smtp_port=465 o smtp_ssl=ssl o default_domain=localhost o error_logfile=error.log o debug_logfile=debug.log o auth_username=[your_gmail_account_username]@gmail.com o auth_password=[your_gmail_account_password] o pop3_server= o pop3_username= o pop3_password= o force_sender= o force_recipient= o hostname=localhost You do not need to specify any value for these properties: pop3_server, pop3_username, pop3_password, force_sender, force_recipient. The error_logfile and debug_logfile settings should be kept blank if you have already sent successful email(s) otherwise size of this file will keep increasing. Enable these log file settings if you dont get able to send email using sendmail.

Enable IMAP Access in your GMails Settings -> Forwarding and POP/IMAP -> IMAP Access:

Enable ssl_module module in Apache server:

Enable php_openssl and php_sockets extensions for PHP compiler:

Open php.ini from C:\wamp\bin\apache\Apache2.2.17\bin and configure it as following (The php.ini at C:\wamp\bin\php\php5.3.x would not work) (You just need to configure the last line in the following code, prefix semicolon (;) against other lines):
[mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = ; http://php.net/smtp-port ;smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = [email protected] ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path

sendmail_path = "C:\wamp\sendmail\sendmail.exe -t -i"

Restart WAMP Server. Create a PHP file and write the following code in it:
<?php $to $subject $message $headers '[email protected]'; 'Testing sendmail.exe'; 'Hi, you just received an email using sendmail!'; 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)) echo "Email sent"; else echo "Email sending failed"; ?> = = = =

Make appropriate changes in $to and $headers variables to set recipient, sender and reply-to address. Save it as send-mail.php. (You can save it anywhere or inside any sub-folder in C:\wamp\www.) Open this file in browser, it MUST work now

You might also like