Skip to content

Commit 3053f6b

Browse files
authored
Merge pull request codex-iter#15 from codex-iter/test
Added newsletter and updated contact form(backend)
2 parents 096e000 + 4ddb7cb commit 3053f6b

File tree

7 files changed

+1119
-1387
lines changed

7 files changed

+1119
-1387
lines changed

contact-us.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//Load Composer's autoloader
1010
require 'vendor/autoload.php';
1111

12-
$email_id = $_POST['email'] ;
12+
$email_id = $_POST['contactEmail'] ;
1313

1414
$mail = new PHPMailer(true); // Passing `true` enables exceptions
1515
try {
@@ -19,7 +19,7 @@
1919
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
2020
$mail->SMTPAuth = true; // Enable SMTP authentication
2121
$mail->Username = 'codex.2.0.contact@gmail.com'; // SMTP username
22-
$mail->Password = 'password'; // SMTP password [Password Changed and removed from GitHub for sequrity]
22+
$mail->Password = ''; // SMTP password [Password Changed and removed from GitHub for sequrity]
2323
//$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
2424
$mail->Port = 25; // TCP port to connect to
2525

@@ -47,4 +47,4 @@
4747
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
4848
}
4949

50-
50+
?>

css/base.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,11 @@ textarea:focus {
524524
background-color: #3d4145;
525525
}
526526

527-
textarea { min-height: 180px; }
527+
textarea {
528+
min-height: 180px;
529+
white-space: pre-wrap;
530+
531+
}
528532

529533
label,
530534
legend {

inc/sendEmail.php

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

33
// Replace this with your own email address
4-
$siteOwnersEmail = 'user@website.com';
5-
4+
$siteOwnersEmail = 'codex.2.0.contact@gmail.com';
5+
6+
use PHPMailer\PHPMailer\PHPMailer;
7+
use PHPMailer\PHPMailer\Exception;
68

79
if($_POST) {
810

@@ -28,7 +30,7 @@
2830

2931

3032
// Set Message
31-
$message .= "Email from: " . $name . "<br />";
33+
$message = "Email from: " . $name . "<br />";
3234
$message .= "Email address: " . $email . "<br />";
3335
$message .= "Message: <br />";
3436
$message .= $contact_message;
@@ -44,13 +46,58 @@
4446
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
4547

4648

47-
if (!$error) {
49+
if (empty($error)) {
4850

4951
ini_set("sendmail_from", $siteOwnersEmail); // for windows server
50-
$mail = mail($siteOwnersEmail, $subject, $message, $headers);
51-
52-
if ($mail) { echo "OK"; }
53-
else { echo "Something went wrong. Please try again."; }
52+
//$mail = mail($siteOwnersEmail, $subject, $message, $headers);
53+
54+
// Import PHPMailer classes into the global namespace
55+
// These must be at the top of your script, not inside a function
56+
57+
58+
59+
60+
//Load Composer's autoloader
61+
require '..\vendor\autoload.php';
62+
63+
//$email_id = $_POST['contactEmail'] ;
64+
65+
$mail = new PHPMailer(true); // Passing `true` enables exceptions
66+
try {
67+
//Server settings
68+
//$mail->SMTPDebug = 2; // Enable verbose debug output
69+
$mail->isSMTP(); // Set mailer to use SMTP
70+
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
71+
$mail->SMTPAuth = true; // Enable SMTP authentication
72+
$mail->Username = 'codex.2.0.contact@gmail.com'; // SMTP username
73+
$mail->Password = ''; // SMTP password [Password Changed and removed from GitHub for sequrity]
74+
//$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
75+
$mail->Port = 25; // TCP port to connect to
76+
77+
//Recipients
78+
$mail->setFrom('codex.2.0.contact@gmail.com', 'CODEX_ITER');
79+
$mail->addAddress($email, $name); // Add a recipient
80+
$mail->addAddress('codex.2.0.contact@gmail.com'); // Name is optional
81+
//$mail->addReplyTo('info@example.com', 'Information');
82+
//$mail->addCC('cc@example.com');
83+
//$mail->addBCC('bcc@example.com');
84+
85+
//Attachments
86+
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
87+
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
88+
89+
//Content
90+
$mail->isHTML(true); // Set email format to HTML
91+
$mail->Subject = $subject;
92+
$mail->Body = $message;
93+
$mail->AltBody = 'Thanks a ton for sending us a message. We were quite lonely here :D .';
94+
95+
$mail->send();
96+
echo 'Message has been sent';
97+
} catch (Exception $e) {
98+
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
99+
}
100+
54101

55102
} # end if - no validation error
56103

@@ -66,4 +113,6 @@
66113

67114
}
68115

116+
117+
69118
?>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy