-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathemail using smtp
40 lines (32 loc) · 1.03 KB
/
email using smtp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$Date = date("Y-m-d");
$Name=$Username1;
$Email=$Email1;
require 'email/PHPMailerAutoload.php';
$mail= new PHPMailer;
$mail->isSMTP();
$mail->Host='smtp.gmail.com';
$mail->Port=587;
$mail->SMTPAuth=true;
$mail->SMTPSecure='tls';
$mail->Username='[email protected]'; /* mail address of your gmail account*/
$mail->Password='Password'; /* password of your gmail account*/
$mail->setFrom('website'); /* name that will appear when mail is send */
$mail->addAddress($Email); /* mail address of that person you want to send mail to */
$mail->addReplyTo('[email protected]'); /* mail address for Reply use */
$mail->isHTML(true);
$mail->Subject=('Sending mail'); /* subject for the mail */
$Message = 'Hi this is Kashif Imran Sending message to u '; /* message body for the mail */
$mail->Body=$Message;
if(!$mail->send())
{
echo"<p class='errormsg'>Send unsuccess</p>";
}
else
{
echo"<p class='errormsg'>Send user success</p>";
}
/* download files for the email method from here
https://github.com/kashif0313/Smtp-mail-method
*/
?>