How to send Emails From PHP using PHPMailer

PHP email transport class featuring file attachments, SMTP servers, CCs, BCCs, HTML messages, word wrap, and more. Sends email via sendmail, PHP mail(), QMail, or with SMTP.

phpmailer_v21download or download it from sourceforge.net

http://sourceforge.net/project/showfiles.php?group_id=26031

put these files in you website root and run the below code to send E mails.

1. class.phpmailer.php

2. class.pop3.php

3. class.smtp.php
<?php
require(“class.phpmailer.php”);
$mail = new phpmailer();
$mail->From     = “info@xyz.com”; //from Email Id
$mail->FromName = “yourname”;  // from name
$mail->Host     = “mail.xyz.com;”; // your websites mail
$mail->Mailer   = “smtp”;

// HTML body
$body  = “Hello <font size=\”4\”>arun</font>, <p>”;
$body .= “<i>Your</i> personal photograph to this message.<p>”;
$body .= “Sincerely, <br>”;
$body .= “phpmailer List manager”;

// Plain text body (for mail clients that cannot read HTML)
$text_body  = “Hello ” . “, \n\n”;
$text_body .= “Your personal photograph to this message.\n\n”;
$text_body .= “Sincerely, \n”;
$text_body .= “phpmailer List manager”;

$mail->Body    = $body;
$mail->AltBody = $text_body;
$mail->AddAddress(‘to@mail.com’,’Arun Raj R’);
$mail->AddStringAttachment(“file”, “YourPhoto.jpg”);

if(!$mail->Send())
echo “There has been a mail error sending to <br>”;

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();

?>

About

me : yeay its me arun

Tagged with: , , , , , , ,
2 comments on “How to send Emails From PHP using PHPMailer
  1. superlolek says:

    and that’s what tigers like 😀

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.