-
Notifications
You must be signed in to change notification settings - Fork 0
/
MailSender4MessageSender.php
46 lines (39 loc) · 1.58 KB
/
MailSender4MessageSender.php
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
41
42
43
44
45
46
<?php
//error_reporting(E_ALL);
require_once "PHPMailer_5.2.0/class.phpmailer.php";
$mail=new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug=2;
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username= '[email protected]'; // SMTP username
$mail->Password = 'Differencing@1805'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->From='[email protected]';
$mail->FromName="Differencing.org";
$mail->addReplyTo('[email protected]', 'Do Not Reply.');
#$mail->addAddress('[email protected]',"Mahendra"); // Add a recipient
#$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
$mail->addAddress("[email protected]", "Mahendra Gupta");
$mail->isHTML(true); // Set email format to HTML
$bodyContent = '<H2>H</h2>';
$bodyContent .= '<p>This is the HTML email sent from localhost using PHP script by <b>CodexWorld</b></p>';
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
#$mail->Subject = 'Email from Localhost by CodexWorld';
#$mail->Body = $bodyContent;
try {
if($mail->send())
{
echo "Message has been sent successfully";
}
else {
//echo "Mailer Error: " . $mail->ErrorInfo;
}
} catch (Exception $e) {
//echo "Mailer Error: " . $mail->ErrorInfo;
}
?>