-
Notifications
You must be signed in to change notification settings - Fork 2
/
f2m.php
54 lines (47 loc) · 1.33 KB
/
f2m.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
<?php
$to = '[email protected]';
$toName = 'Tourism School Toledo';
$debug = false;
$debugTo = '[email protected]';
$debugName = 'Janos Csikos';
$success = false;
$subject = 'Message form the website';
$fromEmail = '[email protected]';
$fromName = 'Website form';
// No need to edit below this line
if($to && !empty($_POST)) {
$msg = '';
foreach ($_POST as $field => $val) {
$fld = strtoupper($field);
$msg .= $fld . ":<br>" . htmlentities($val, ENT_QUOTES, "UTF-8") . "<br><br>\n";
}
date_default_timezone_set('Etc/UTC');
require './libs/PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
$mail->Host = "smtp.zoho.com";
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "Villaseca234";
$mail->setFrom($fromEmail, $fromName);
if ($debug) {
$mail->addAddress($debugTo, $debugName);
} else {
$mail->addAddress($to, $toName);
}
$mail->Subject = $subject;
$mail->msgHTML($msg);
$success = $mail->send();
// var_dump($success);
// echo $mail->ErrorInfo;
}
echo $success ? 'ok' : 'error';