SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict agentforte's Avatar
    Join Date
    May 2007
    Location
    Toronto, ON, Canada
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Connecting with SMTP using phpmailer

    My hosting company had the following about sending SMTP:

    You may have noticed that your Internet Service Provider (ISP) does not allow you to use mail.yourdomain.com as the outgoing SMTP server. When this happens it basically means your ISP wants you to use their SMTP server and only their SMTP server. There is a work around for you if you find yourself in this situation. Since your ISP is actually blocking port 25, the default port for SMTP traffic, we have set up a secondary port that you can use, port 587. You can configure your mail client to use port 587 instead of port 25

    now I tried the following:

    PHP Code:
    $mail->From 'admin@mysite.com';
    $mail->FromName 'Contact Form';

    $mail->IsSMTP();
    $mail->Host     "mail.hostingcompany.com"// specified by hosting company
    $mail->Port     587;
    $mail->SMTPAuth false;

    $mail->Subject $subject;
    $mail->Body $body;
    $mail->AltBody $text_body;
    $mail->AddAddress('admin@mysite.com''Admin');

    if (
    $emailcopy == 'yes') {
    $mail->AddCC($email$name); 
    }

        if (!@
    $mail->Send()) {
        
    $mailerr .= '<br />There was a problem sending your message. Please try again.';
        } else {
        
    $successmsg .= '<br />Success! If you chose to receive a copy of your message, it may take a few moments to reach your inbox.';
        } 
    but I am still having problems sending smtp email. Does anyone know what the problem might be?

    -Frank

  2. #2
    SitePoint Addict agentforte's Avatar
    Join Date
    May 2007
    Location
    Toronto, ON, Canada
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So the problem still has to do with adding a CC. when I remove the CC, the email can send via SMTP, but as soon as I add the line

    $mail->AddCC('my@email.com', 'name');

    it does not send.

    Does anyone have a working script that adds a cc using phpmailer?

  3. #3
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are your display_errors and error_reporting configured to talk to you? Maybe there's something wrong with that line - what does the script output?

  4. #4
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looking at your code again - the variable "$email" you're passing to AddCC isn't defined anywhere in the script - or is that just part of your code?

  5. #5
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you get anything with:
    PHP Code:
    $mail->Error
    (check that syntax, I haven't used PhpMailer for a while, so I forget if its a variable, or a function, and the exact name).

    It may also be possible (though unlikely) that your host blocked carbon copies.

  6. #6
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does it just not send the CC or does the whole message fail?

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had the same problem a day ago. Remove the $mail->SMTPAuth = false;
    . If that doesn't work then make sure your php.ini settings are correct:

    smtp server: mail.hostingcompany.com
    port 25

    Try using port 25, it might work.


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
  •