If you want to send mail from your localhost/PC then here is the solution
1. First of all you need to install WAMP/XAMPP server.
2. Download this send mail Download the sendmail.zip which is only 1.08 MB file.
3.Unzip the file and keep all files in a folder name sendmail in in “C:\wamp\”. so it'll looks like in “C:\wamp\sendmail”.
[For xampp sendmail already exist]
4. Open the “sendmail.ini” file and configure it as following
5. Enable IMAP Access in your GMail’s Settings -> Forwarding and POP/IMAP -> IMAP Access:
6. Enable “ssl_module” module in Apache server: for XAMPP click configure from xampp control and open php.ini file and uncomment php_openssl extensions .
7. Enable “php_openssl” and “php_sockets” extensions for PHP compiler:
8 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):
[For XAMPP click configure from xampp control and open php.ini ]
Open this file in browser,now it should work
If it shows "Cannot Send Email" please refresh the page..It'll work
Thanks
1. First of all you need to install WAMP/XAMPP server.
2. Download this send mail Download the sendmail.zip which is only 1.08 MB file.
3.Unzip the file and keep all files in a folder name sendmail in in “C:\wamp\”. so it'll looks like in “C:\wamp\sendmail”.
[For xampp sendmail already exist]
4. Open the “sendmail.ini” file and configure it as following
- smtp_server=smtp.gmail.com
- smtp_port=465
- smtp_ssl=ssl
- default_domain=localhost
- error_logfile=error.log
- debug_logfile=debug.log
- auth_username=[your_gmail_account_username]@gmail.com
- auth_password=[your_gmail_account_password]
- pop3_server=
- pop3_username=
- pop3_password=
- force_sender=
- force_recipient=
- hostname=localhost
5. Enable IMAP Access in your GMail’s Settings -> Forwarding and POP/IMAP -> IMAP Access:
6. Enable “ssl_module” module in Apache server: for XAMPP click configure from xampp control and open php.ini file and uncomment php_openssl extensions .
7. Enable “php_openssl” and “php_sockets” extensions for PHP compiler:
8 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):
[For XAMPP click configure from xampp control and open php.ini ]
[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 = you@domain.com ; 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"
[ for XAMPP sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" ]
9 . Restart WAMP Server.
10. Create a PHP file and write the following code in it:
11. <?php
$to = 'recipient@yahoo.com';
$email="sender@gmail.com"; // from email address
$subject = 'Testing sendmail.exe';
$message = 'Hi, you just received an email using sendmail!';
$headers = 'From: sender@gmail.com' . "\r\n" .
'Reply-To: sender@gmail.com' . "\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";
?>
Open this file in browser,now it should work
If it shows "Cannot Send Email" please refresh the page..It'll work
Thanks
This comment has been removed by a blog administrator.
ReplyDelete