-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailtest.php
46 lines (42 loc) · 1.9 KB
/
mailtest.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
function send_mail($email,$body,$body1){
require_once('PHPMailer-master/PHPMailerAutoload.php');
echo "after require";
$mail = new PHPMailer;
//$path="images/landlogo.png";
//echo "mail obj ".$mail;
$mail->isSMTP(); // Set mailer to use SMTP
//$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
//$mail->Host = 'smtp.mailgun.org'; // Specify main and backup SMTP servers
$mail->Host ='cp-in-17.webhostbox.net';
$mail->SMTPAuth = true;
echo "after auth"; // Enable SMTP authentication
//$mail->Username = '[email protected]'; // SMTP username
$mail->Username = '[email protected]'; // SMTP username
//$mail->Password = 'ea215a2bb46488c538e3904e52ee8f1d'; // SMTP password
$mail->Password = 'gyanith@2018';
echo "after passwd";
$mail->SMTPSecure = 'tls';
$mail->Port =465;
//$mail->From='[email protected]'; // Enable encryption, only 'tls' is accepted
$mail->From='[email protected]'; // Enable encryption, only 'tls' is accepted
$mail->FromName = 'Gyanith18';
$mail->addAddress($email); // Add a recipient
echo "after address";
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->Subject = 'gyanith 18 Registration';
$mail->Body = $body;
$mail->AltBody = $body1;
//$mail->addAttachment($path);
$mail->SMTPDebug = 3;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
}
echo "starting to send email";
send_mail("[email protected]","body content","body content2");
echo "after send email function";
?>