ANIL KUMAR PANIGRAHI 's Blog

How to send mail using phpmailer class

Posted by: Anil Kumar Panigrahi in: ● February 8, 2010

The following script is for how sending mails using php code.

1) Download php classes from below url

http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/

2) Place in your application www/yourapplication/

those files are class.phpmailer.php and class.smtp.php

3) Now take a another php file to send the mails.

require(“class.phpmailer.php”);
require(“class.smtp.php”);

// including files in your send mail file.

$mail = new PHPMailer(); // create a object to that class.
$mail->IsMail();
$mail->Timeout  = 360;
$mail->Subject =  ‘Test Subject’;
$from = ‘Anil Labs’;
$mail->From = ‘mail@yourdomain.com’;
$mail->FromName = ‘Anil Labs’;
$mail->AddReplyTo(‘mail@yourdomain.com’, $from);
$to = ‘user@somedomain.com’;
$mail->AddAddress($to, “”);

$mail->Body = “<html>
<head>

<title></title>
</head>
<body>
Test Message
</body>
</html>”;
$mail->IsHTML(true);
$mail->Send();

Then it will sends the mail to particular email-id.

Share on Twitter

1 Comment to "How to send mail using phpmailer class"

1 | Tamada Ravi Kumar

10 de March de 2010 to ● 6:25 pm

Hello !

It was a nice tutorial easy send an email. ThanQ.

( i am srinivas tamada brother )

Write Comment

About Me

  Anil Kumar Panigrahi
  Software Engineer (PHP)
  Blogger & Founder of Anil Labs
  Baruva, India

You can share with me . . .

My Own Contributions

1) First contribution for codeigniter framework ( multi language support using google translate API ). we can get files from http://github.com/nyros/codeigniter_multilanguage


2) Audio and Video Streaming using FFMpeg and PHP -complete doc file : http://www.docstoc.com/docs/8300349/Audio-and-Video-Streaming

Twitter Updates

Follow me @anil2u