forked from XinFinOrg/Official-XinFinOrg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontactpost.php
116 lines (107 loc) · 3.7 KB
/
contactpost.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST'){
require 'mail/PHPMailerAutoload.php';
$name = (isset($_POST['name'])?$_POST['name']:"");
$email = (isset($_POST['email'])?$_POST['email']:"");
$mobile = (isset($_POST['contact'])?$_POST['contact']:"");
$comments = (isset($_POST['comments'])?$_POST['comments']:"");
$subject = "Contact Enquiry | Xinfin";
$subject_to_user = "Thank You for Contacting Us | Xinfin";
$message = "<div>
<b><h3>Contact Enquiry | Xinfin</h3></b>
<h4>User Details</h4>
<p>
Name : $name <br>
Email : $email <br>
Mobile Number : $mobile<br>
Comments : $comments
</p>
</div>";
$message_to_user = "<div>
<p style='font-weight: normal;'>Hello, $name</p>
<p style='font-weight: normal;'>Thank you for contacting us! We will get back to you soon.</p>
<p style='font-weight: normal;'>Team Xinfin</p>
</div>";
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$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';
//Set the hostname of the mail server
$mail->Host = "mail-b01.cloudmailbox.in"; /* your mail host here */
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
$mail_to_user = new PHPMailer;
$mail_to_user->isSMTP();
$mail_to_user->SMTPDebug = 0;
$mail_to_user->Debugoutput = 'html';
$mail_to_user->Host = "mail-b01.cloudmailbox.in";
$mail_to_user->Port = 25;
$mail_to_user->SMTPAuth = true;
try{
//Username to use for SMTP authentication
$mail->Username = "[email protected]"; /* your username here */
//Password to use for SMTP authentication
$mail->Password = "Hak-ess@2018**"; /* your password here */
//Set who the message is to be sent from
$mail->setFrom("[email protected]" ,"Contact Enquiry | Xinfin");
//Set an alternative reply-to address
$mail->addReplyTo($email, $name);
//Set who the message is to be sent to
/* $mail->addAddress('[email protected]', 'Admin'); */
$mail->addAddress('[email protected]', 'Admin');
//Set the subject line
$mail->Subject = $subject;
$body = '<html>
<body>
<div><br />
<b> '.$message.'</b><br />
</div>
</body>
</html>
';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($body);
if ($mail->send()) {
echo "mailsent";
}else{
echo "failed";
}
//Username to use for SMTP authentication
$mail_to_user->Username = "[email protected]"; /* your username here */
//Password to use for SMTP authentication
$mail_to_user->Password = "Hak-ess@2018**"; /* your password here */
$mail_to_user->setFrom("[email protected]" ,"Contact Enquiry | Xinfin");
$mail_to_user->addReplyTo($email, $name);
$mail_to_user->addAddress($email, 'User');
//$mail_to_user->addAddress('[email protected]', 'Admin');
$mail_to_user->Subject = $subject_to_user;
$body = '<html>
<body>
<div><br />
<b> '.$message_to_user.'</b><br />
</div>
</body>
</html>
';
$mail_to_user->msgHTML($body);
if ($mail_to_user->send()) {
echo "mailsent";
}else{
echo "failed";
}
}catch(phpmailerException $e){
echo $mail->errorMessage(); //Pretty error messages from PHPMailer
echo $mail_to_user->errorMessage(); //Pretty error messages from PHPMailer
}
}
?>