Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'class.phpmailer.php'; // path to the PHPMailer class
- require 'class.smtp.php';
- $mail = new PHPMailer();
- $mail->IsSMTP(); // telling the class to use SMTP
- $mail->SMTPDebug = 2;
- $mail->Mailer = "smtp";
- $mail->Host = "ssl://smtp.gmail.com";
- $mail->Port = 587;
- $mail->SMTPAuth = true; // turn on SMTP authentication
- $mail->Username = "myemail@gmail.com"; // SMTP username
- $mail->Password = "mypasswword"; // SMTP password
- $Mail->Priority = 1;
- $mail->AddAddress("myemail@gmail.com","Name");
- $mail->SetFrom($visitor_email, $name);
- $mail->AddReplyTo($visitor_email,$name);
- $mail->Subject = "Message from Contact form";
- $mail->Body = $user_message;
- $mail->WordWrap = 50;
- if(!$mail->Send()) {
- echo 'Message was not sent.';
- echo 'Mailer error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent.';
- }
- $mail->IsSMTP();
- //Set the hostname of the mail server
- $mail->Host = 'smtp.gmail.com';
- //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission 465 ssl
- $mail->Port = 465;
- //Set the encryption system to use - ssl (deprecated) or tls
- $mail->SMTPSecure = 'ssl';
- + $mail->SMTPSecure = 'tls';
- - $mail->Host = "ssl://smtp.gmail.com";
- + $mail->Host = "smtp.gmail.com";
- ###############################################################################
- # SECTION:SMTP Settings
- ###############################################################################
- # Block outgoing SMTP except for root, exim and mailman (forces scripts/users
- # to use the exim/sendmail binary instead of sockets access). This replaces the
- # protection as WHM > Tweak Settings > SMTP Tweaks
- #
- # This option uses the iptables ipt_owner/xt_owner module and must be loaded
- # for it to work. It may not be available on some VPS platforms
- #
- # Note: Run /etc/csf/csftest.pl to check whether this option will function on
- # this server
- # SMTP_BLOCK = "1" --> this will cause phpmailer Connection timed out (110)
- SMTP_BLOCK = "0"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement