This post explains how to send mail using phpmailer class. With few steps we can integrate it into our website. The following script is for how sending mails using php code.

1) Download php classes from below url

 

 

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 = '[email protected]';
$mail->FromName = 'Anil Labs';
$mail->AddReplyTo('[email protected]', $from);
$to = '[email protected]';
$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.


6 Comments

Tamada Ravi Kumar · March 10, 2010 at 6:25 pm

Hello !

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

( i am srinivas tamada brother )

Suresh · August 3, 2010 at 10:28 am

Really nice & easy to use…

Semakula kraiba · September 24, 2011 at 8:16 pm

simple send

Raj · November 4, 2011 at 3:50 am

very good stuff, thanks .

sangeet · March 4, 2013 at 9:40 am

thanks its awesome

How to add HTML content in php mail() function | ANIL KUMAR PANIGRAHI 's Blog · June 8, 2011 at 9:40 am

[…] to php mail() function. Few servers are supports php mailer class then we can send mails with Sending mails using php mailer class . And few servers are not supporting php mailer class. For those below function will be useful to […]

Leave a Reply

Avatar placeholder

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