-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.php
57 lines (40 loc) · 1.66 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
require './PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer(true);
$mail->IsSMTP(); // telling the class to use SMTP IsSMTP();
$mail->SMTPDebug = 2;
// 0 = no output, 1 = errors and messages, 2 = messages only.
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "ssl0.ovh.net"; // sets Gmail as the SMTP server ssl0.ovh.net
$mail->Port = 465; // set the SMTP port for the MAIL
$mail->Username = "no-reply%logysoft.fr"; // mail username
$mail->Password = "thingtrack"; // mail password
$mail->SetFrom ('no-reply@logysoft.fr', 'Logysoft - Demande de contact');
$mail->Subject = 'Logysoft - Demande de contact';
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$timestamp = date("F jS Y, h:iA.", time());
$name = $_POST['nom'];
$email = $_POST['email'];
$message = $_POST['message'];
$body = "
<br>
<p><strong>Nom</strong>: $name</p>
<p><strong>Email</strong>: $email</p>
<p><strong>Message</strong>: $message</p>
<hr/>
<p>Demande réalisée à la date <strong>$timestamp</strong></p>
";
$mail->Body = $body;
$mail->AddAddress ('no-reply@logysoft.fr', 'Info Logysoft');
// you may also use this format $mail->AddAddress ($recipient);
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
} else
{
echo "$success";
}
// You may delete or alter these last lines reporting error messages, but beware, that if you delete the $mail->Send() part, the e-mail will not be sent, because that is the part of this code, that actually sends the e-mail.
?>