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();

?>

Filed Under: emailPHPProgramming

Tags:

About the Author: me : yeay its me arun

RSSComments (2)

Leave a Reply | Trackback URL

  1. superlolek says:

    and that’s what tigers like :D

Leave a Reply

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin