1 | Download PHPMailer from http://phpmailer.sourceforge.net |
2 | Extract to folder phpmailer |
3 | Create a file email.php |
4 | Paste this code and change the values in blue as you need (I modified the sample code given on the PHPMailer homepage) require("phpmailer/class.phpmailer.php"); |
5 | Open the file class.smtp.php in phpmailer directory |
6 | Paste this code $host = "ssl://smtp.gmail.com"; $port = 465; before the line 104 #connect to the smtp server Hint: Search for #connect |
7 | Open this page in browser and it will send the email using GMail. |
Hint: When you want to email the details from a form, set the variables using the form variables. eg. $mail->Username=$_POST['email'] |
Wednesday, December 16, 2009
PHP sending emails with gmail smtp to prevent spam mails
Subscribe to:
Posts (Atom)