SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru hifigrafix's Avatar
    Join Date
    Oct 2005
    Location
    Nashville, TN
    Posts
    628
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Mailer Results In Timeout

    Greetings,

    I've used PHPMailer for the past 6 years with little issue. We're on a new dedicated server which seems otherwise awesome but loading up a standalone phpmailer install results in the browser "loading" spinner and never sends.

    I'm particularly trying to route through google just for the sake of this particular development.

    The spinner is a result of both my custom scripting and I've confirmed it in the DEFAULT example code that comes with phpmailer. If you take out $mail->send() the page reloads immediately but is blank. If you put $mail->send() back in it spins and spins and spins.

    PHP Code:
    <html>
    <head>
    <title>PHPMailer - SMTP basic test with authentication</title>
    </head>
    <body>

    <?php

    //error_reporting(E_ALL);
    error_reporting(E_STRICT);

    date_default_timezone_set('America/Toronto');

    require_once(
    'includes/phpmailer_full/class.phpmailer.php');
    //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

    $mail             = new PHPMailer();
    $body 'test';

    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->SMTPDebug  2;                     // enables SMTP debug information (for testing)
                                               // 1 = errors and messages
                                               // 2 = messages only
    $mail->SMTPAuth   true;                  // enable SMTP authentication
    $mail->Host       "smtp.gmail.com"// sets the SMTP server
    $mail->Port       465;                    // set the SMTP port for the GMAIL server
    $mail->Username   "jon@hiddendomain.com"// SMTP account username
    $mail->Password   "adsflkjasdf";        // SMTP account password


    $mail->Subject    "PHPMailer Test Subject via smtp, basic with authentication";

    $mail->AltBody    "To view the message, please use an HTML compatible email viewer!"// optional, comment out and test

    $mail->MsgHTML($body);

    $address "jon@hiddenendomain.com";
    $mail->AddAddress($address"jon");

    if(!
    $mail->Send()) {
      echo 
    "Mailer Error: " $mail->ErrorInfo;
    } else {
      echo 
    "Message sent!";
    }

    ?>

    </body>
    </html>
    I was trying PHPMailer Lite but received issues with it not being able to find /usr/sbin/sendmail which is the correct path and seemingly correct permissions.

    Any help is greatly appreciated.

  2. #2
    SitePoint Addict kduv's Avatar
    Join Date
    May 2012
    Location
    Atlanta, GA
    Posts
    244
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Have you tried it without using SMTP, using sendmail instead? Do you see anything if you change the debug level to 1? What happens if you use the standard PHP function mail() to send a test email?

  3. #3
    SitePoint Guru hifigrafix's Avatar
    Join Date
    Oct 2005
    Location
    Nashville, TN
    Posts
    628
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without SMTP this is what I get.

    Code:
    Mailer Error: Could not instantiate mail function.
    For what it's worth my sendmail_from ini is set to "no value"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •