1

I need to send mail using PHP Mailer.

Mail is sending but not received in gmail. In phpmailer folder i have 3 files: class.phpmailer.php, class.smtp.php, PHPMailerAutoload.php

require 'phpmailer/PHPMailerAutoload.php';

    $mail = new PHPMailer;
    $mail->isSMTP();

    $mail->Host='smtp.gmail.com';
    $mail->Port=587;
    $mail->SMTPAuth=true;
    $mail->SMTPSecure='tls';

    $mail->Username='mail@gmail.com';
    $mail->Password='password';

    $mail->setFrom('mail@gmail.com','Company');
    $mail->addAddress('company@gmail.com');
    $mail->addReplyTo('mail@gmail.com');

    $mail->isHTML(true);
    $mail->Subject='New Form Submission';
    $mail->Body='<h1>Hello</h1>';

    header("Location: ../123.php");
Mix
  • 9
  • 3
  • Do you get an error? – SLaks May 02 '19 at 19:35
  • 1
    Possible duplicate of [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – Patrick Q May 02 '19 at 19:41
  • 1
    It seems like you are using an outdated version of phpmailer, my first step would be to try to update phpmailer. – GrumpyCrouton May 02 '19 at 19:43
  • It is not php mail() fuction, it is php mailer and it`s 5.2 stable version. No error, email sending but not received in gmail. I tried many gmail accounts. I am also turned on "Less secure app access" in gmail account security and 2-step verification. – Mix May 02 '19 at 19:53
  • 2
    @Mix Did you read the very first question of the linked answer? Or did you just immediately dismiss the idea that it could be helpful? You've also confirmed that you are, in fact, using an outdated version of PHPMailer. 5.2 has been completely unsupported (not even security updates) since the beginning of this year. – Patrick Q May 02 '19 at 19:54
  • @Patrick Q I don`t understand how it may be helpfull – Mix May 02 '19 at 20:01
  • Turn on debug output to be sure what’s happening to your messages. If they are sending successfully, check your spam folder; It’s what gmail calls the inbox these days. – Synchro May 02 '19 at 20:02
  • 1
    @GrumpyCrouton Right. I was pointing out that while OP seems to be arguing that it is _not_ out of date, that they were in fact proving that it _is_. – Patrick Q May 02 '19 at 20:02
  • @Mix Let's start here... Have you taken the time to actually read through all of that answer and comprehend what it is saying to do? – Patrick Q May 02 '19 at 20:05
  • @Mix update your question, because you are using a plugin/addons, not a native function of PHP, we need bring more information if want help from anyone in this web... plz add: Version of PHPmailer; make the test with development option, an including Debug option and bring the ouput of it. even you will get new help... –  May 02 '19 at 20:15

0 Answers0