Login to Members Area

Choose the service you want to log in
     
24x7x365 Presence
1-888-289-2246
Live Chat

Hosting Blog

 

Sample PHPMailer Script

To enable SMTP AUTH in PHPMailer:

First download the PHPMailer class file from the site http://phpmailer.sourceforge.net.

Save it as a php-file in the same directory as your script.

Include this script in your code:

<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail = new PHPMailer(); //Create PHPmailer class
$mail->From = "[email protected]"; //Sender address
$mail->FromName = "BUZZINESS WORLD "; //The name that you'll see as Sender
$mail->Host = "mail.domain.com"; //Your SMTP mail server
$mail->Port = '587';
$mail->Mailer = "smtp"; //Protocol to use
$mail->AddAddress("[email protected]"); //The address you are sending mail to
$mail->Subject = "Mail Subject"; //Subject of the mail
$mail->Body = "Write your mail here"; //Body of the message
$mail->SMTPAuth = "true";
$mail->Username = "[email protected]"; //valid email id of the domain
$mail->Password = "password"; //password for [email protected]
if(!$mail->Send()){ //Check for result of sending mail
echo "There was an error sending the message"; //Write an error message if mail isn't sent"
exit; //Exit the script without executing the rest of the code
}
echo "Your query has been sent";
?>

Manoj Thursday 13 June 2013 - 8:48 pm | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.