-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto.php
61 lines (44 loc) · 2.06 KB
/
auto.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
if (isset($_POST['submit'])){
$name=$_POST["name"];
$email=$_POST["email"];
$password=$_POST["password"];
$college=$_POST["college"];
$mobile_no=$_POST["mobile"];
$body = 'Hi '.$name.' ,you have successfully registered in our kreiva event.<br />'.'Your mobile number is: '.$mobile_no.'.<br />Your college name is:'.$college.'.<br /> Your email id is: '.$email.'.<br /> Your password is:'.$password.'<br />';
send_mail($email, $body, $name);
}
function send_mail($email,$body,$name){
require('PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
//$mail->SMTPDebug = 4; // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = ''; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
$mail->setFrom($email); //Set who the message is to be sent from
$mail->addReplyTo($email, $name); //Set an alternative reply-to address
$mail->addAddress($email); // Name is optional
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = "Request";
$mail->Body = $body;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
print_r($mail->ErrorInfo);
exit;
}
echo 'Message has been sent';
}
?>