-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
50 lines (31 loc) · 1.35 KB
/
index.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
<?php
require_once 'vendor/autoload.php';
if($_SERVER['SERVER_NAME']=='localhost'){
$transport = (new Swift_SmtpTransport('smtp.mailtrap.io', 25))
->setUsername('1f0967eefcca56')
->setPassword('636f74335f3d6a');
}else{
$transport = Swift_MailTransport::newInstance();
}
if (isset($_POST["submit"]))
{
$name = $_POST["name"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$body = $_POST["message"];
$mailer= Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Contact')
-> setFrom([$email => 'Sahar FRIKHA'])
-> setTo(['[email protected]'])
-> setBody("Dear : UniQ Soft Technology Administrator \nKindly be informed that you have recieved a contact demande you will find the needed info and message below : \nName :".$name. " \nPhone :".$phone." \nEmail adresse :".$email." \nDemand : ".$body." \n \nBest regards,");
$result = $mailer->send($message);
$mailer= Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Contact')
-> setFrom(['[email protected]' => 'Sahar FRIKHA'])
-> setTo([$email])
-> setBody("Dear :".$name." \nKindly be informed that we have recieved your contact demande. Our Administrator will contact you in the brief delay.\n \nBest regards,");
$result = $mailer->send($message);
header('Location: index.html');
exit();
}
?>