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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<?php
$email_subject = "AlphaStep Website Subscriber - ".date("Ymd");
$body = '<html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> body,td,th { font-size: 20px; font-family: Arial, Helvetica, sans-serif, Simhei, STHeiti, Apple LiGothic Medium"; color: #000; } a {color: #cfa231;} </style> </head> <body><center><table width="570" border="0" cellspacing="0" cellpadding="0"><tbody> <tr><td>';
$body .= '<br>New Subscriber:'.$_POST["subscribe-email"].'<br><br><br>Subscription date:'.date("Ymd");
$body .= '</td> </tr></tbody></table></center>'; $body .= '</body></html>';
$sender_email = "info@alphastep.com.hk";
$receiver = "info@alphastep.com.hk"; //$receiver = "skycheng@onesolution.com.hk";
require_once('./inc/class.phpmailer.php');
$x_mail = new PHPMailer(); $x_mail->IsSMTP();
$x_mail->Host = 'smtp.sendgrid.net'; // Specify main and backup server $x_mail->Port = 587; // Set the SMTP port $x_mail->SMTPAuth = true; // Enable SMTP authentication $x_mail->Username = 'apikey'; // SMTP username $x_mail->Password = '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'; // SMTP password $x_mail->SMTPSecure = 'tls';
$x_mail->CharSet = "UTF-8"; $x_mail->Sender = $sender_email; $x_mail->AddReplyTo($sender_email, "sender"); $x_mail->From = $sender_email; $x_mail->FromName = "FromName";
$x_mail->AddAddress($receiver, "name"); //$x_mail->AddBCC($receiver, "BCC name");
$x_mail->WordWrap = 50; $x_mail->IsHTML(true); $x_mail->Subject = $email_subject; $x_mail->Body = $body;
if ($x_mail->Send()) { echo "true"; } else { echo "false"; }
header('Location: http://www.alphastep.com.hk/');
?>
|