Sending mail

Using PHPMailer

PHPMailer
 a powerful email transport class with a big features and small 
footprint that is simple to use and integrate into your own software.

Source : http://phpmailer.codeworxtech.com/ 
 
include("class.phpmailer.php");
$mail = new PHPMailer();
$mail->From = 'noreply@htmlblog.net'; // your email address
$mail->FromName = 'HTML Blog'; // Your Name
$mail->Host = 'smtp.site.com'; // Your SMTP Name/Setting/String
$mail->Mailer = 'smtp';
$mail->Subject = 'My Subject'; // E-Mail Subject 
$mail->IsHTML(true); //Specifies whether the Mail has Html code /Html Page or No
$body = 'Hello<br/>How are you ?'; // email body with html code
$textBody = 'Hello, how are you ?'; // plain email body in case html code is not allowed
$mail->Body = $body;
$mail->AltBody = $textBody;
$mail->AddAddress('asvin [@] gmail.com'); // email address of the receiver
if(!$mail->Send()) 
 echo 'There has been a mail error !';  // Error shown if case mail not send
 
// Change the Content Coloured In Red, as per your requirements/needs 

No comments:

Post a Comment