Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $to = “myMail@gmail.com“; // <– My Mail Id
- $subject = “Test mail”;
- $message = “Hello! This is a simple test email message.”;
- $from = “sender@emailaddress.here“;
- $headers = “From:” . $from;
- mail($to,$subject,$message,$headers);
- echo “Mail Sent.”;
- ?>
- <?php
- require "mailer/autoload.php";
- $name = $_POST['name'];
- $contact = $_POST['mobile'];
- $email = $_POST['email'];
- $developmentMode = true;
- $mailer = new PHPMailer($developmentMode);
- try {
- $mailer->SMTPDebug = 2;
- $mailer->isSMTP();
- if ($developmentMode) {
- $mailer->SMTPOptions = [
- 'ssl'=> [
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- ]
- ];
- }
- $mailer->Host = 'smtp.secureserver.net';
- $mailer->SMTPAuth = true;
- $mailer->Username = 'Username@domain.com';
- $mailer->Password = 'Password';
- $mailer->SMTPSecure = 'ssl';
- $mailer->Port = 465;
- $mailer->setFrom('Username@domain.com');
- $mailer->addAddress('Username@domain.com');
- $mailer->isHTML(true);
- $mailer->Subject = 'Subject';
- $mailer->Body = 'Mail Body';
- $mailer->send();
- $mailer->ClearAllRecipients();
- echo ' <script type="text/javascript">
- setTimeout(function () {
- swal({
- title: "Congratulations!",
- text: "Your initiative shows your determination.",
- type: "success",
- confirmButtonText: "OK"
- },
- function(isConfirm){
- if (isConfirm) {
- window.location.href = "franchise.php";
- }
- }); });
- </script>';
- } catch (Exception $e) {
- echo ' <script type="text/javascript">
- setTimeout(function () {
- swal({
- title: "OOOPs!!",
- text: "Entered E-Mail Address not valid Please Enter Valid Email
- Address",
- type: "error",
- confirmButtonText: "OK"
- },
- function(isConfirm){
- if (isConfirm) {
- window.location.href = "franchise.php";
- }
- }); });
- </script>';
- }
- ?>
Add Comment
Please, Sign In to add comment