Your Ad Here

Home » Mail, PHP Code »

5

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 = '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.


You may like these posts

    How to connect to FTP and upload file using php code?Mysql Date functions in php codeHow to get the real IP address using php?How to take backup of Database using PHP code?

 

5 Comments

  1. Tamada Ravi Kumar says:

    Hello !

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

    ( i am srinivas tamada brother )

  2. Suresh says:

    Really nice & easy to use…

  3. Raj says:

    very good stuff, thanks .

Leave a Reply