Created
April 26, 2020 18:32
-
-
Save moshiurse/c2e0617048ddba413d74061f46ba2087 to your computer and use it in GitHub Desktop.
Php get mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="row contact_form" action="contact_process.php" method="post" id="contactForm" novalidate="novalidate"> | |
<div class="col-md-6"> | |
<div class="form-group"> | |
<input type="text" class="form-control" id="name" name="name" placeholder="Enter your name"> | |
</div> | |
<div class="form-group"> | |
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email address"> | |
</div> | |
<div class="form-group"> | |
<input type="text" class="form-control" id="subject" name="subject" placeholder="Enter Subject"> | |
</div> | |
</div> | |
<div class="col-md-6"> | |
<div class="form-group"> | |
<textarea class="form-control" name="message" id="message" rows="1" placeholder="Enter Message"></textarea> | |
</div> | |
</div> | |
<div class="col-md-12 text-right"> | |
<button type="submit" value="submit" class="btn submit_btn">Send Message</button> | |
</div> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$to = "dev@moshiurse.com"; | |
$from = $_REQUEST['email']; | |
$name = $_REQUEST['name']; | |
$csubject = $_REQUEST['subject']; | |
$number = $_REQUEST['number']; | |
$cmessage = $_REQUEST['message']; | |
$headers = "From: $from"; | |
$headers = "From: " . $from . "\r\n"; | |
$headers .= "Reply-To: ". $from . "\r\n"; | |
$headers .= "MIME-Version: 1.0\r\n"; | |
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; | |
$subject = "You have a message from ". $name; | |
$logo = 'img/logo.png'; | |
$link = '#'; | |
$body = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Express Mail</title></head><body>"; | |
$body .= "<table style='width: 100%;'>"; | |
$body .= "<thead style='text-align: center;'><tr><td style='border:none;' colspan='2'>"; | |
$body .= "<a href='{$link}'><img src='{$logo}' alt=''></a><br><br>"; | |
$body .= "</td></tr></thead><tbody><tr>"; | |
$body .= "<td style='border:none;'><strong>Name:</strong> {$name}</td>"; | |
$body .= "<td style='border:none;'><strong>Email:</strong> {$from}</td>"; | |
$body .= "</tr>"; | |
$body .= "<tr><td style='border:none;'><strong>Subject:</strong> {$csubject}</td></tr>"; | |
$body .= "<tr><td></td></tr>"; | |
$body .= "<tr><td colspan='2' style='border:none;'>{$cmessage}</td></tr>"; | |
$body .= "</tbody></table>"; | |
$body .= "</body></html>"; | |
$send = mail($to, $subject, $body, $headers); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mail function] | |
; XAMPP: Don’t remove the semi column if you want to work with an SMTP Server like Mercury | |
SMTP = //your smtp address | |
smtp_port = //your smtp port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment