-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend-email.php
40 lines (30 loc) · 1.37 KB
/
send-email.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
<?php
require 'PHPMailer-master/class.phpmailer.php';
require 'PHPMailer-master/class.smtp.php';
//include 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = 'smtp';
$mail->Host = 'smtp.gmail.com'; // "ssl://smtp.gmail.com" didn't worked
//$mail->Port = 465;
//$mail->SMTPSecure = 'ssl';
//echo !extension_loaded('openssl')?"Not Available":"Available";
// or try these settings (worked on XAMPP and WAMP):
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPDebug=3;
$mail->SMTPAuth=true;
$mail->Username = "[email protected]";
$mail->Password = "KNOWledge@second";
$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.
$mail->From = "[email protected]";
$mail->FromName = "Akshay";
$mail->addAddress("[email protected]","Akshay");
$mail->Subject = "New Registration to MediFind";
$mail->Body = "Hi,<br /><br />There is a new Registration to MediFind!!<br>First Name: $xfname<br>Middle Name: $xmname<br>Last Name: $xlname<br>Phone No.:$xphno<br>Email ID: $xemail<br><br>Tesing Mail Services at MediFind WP Project!!";
if(!$mail->Send())
echo "Email was not sent <br />PHPMailer Error: " . $mail->ErrorInfo;
else
echo "Email has been sent";
?>