Cant send email

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Cant send email

Post by shiznatix »

Yayaya! Ok so I am trying to send an email with the latest php4 version but it wont go. Heres how I try:

Code: Select all

require('./Swift/Swift.php');
    require('./Swift/Swift/Connection/SMTP.php');

    $connection = new Swift_Connection_SMTP('smtp.mediapostinc.com');

    $mailer = new Swift($connection);

    if ($mailer->authenticate('**MY_USER**', '**MY_PASS**'))
    { 
        //If anything goes wrong you can see what happened in the logs
        if ($mailer->isConnected()) //Optional
        {
            //Sends a simple email
            $mailer->send(
                'andrew@mediapostinc.com',
                'kerkface@yaya.com',
                'Some Subject',
                'Hello Joe it\'s only me!'
            );
            //Closes cleanly... works without this but it's not as polite.
            $mailer->close();
        }
        else
        {
            echo 'FAILED';
            dump($mailer->errors);
            dump($mailer->transactions);
            die();
        }
    }
    else
    {
        echo 'FAILED user/pass';
        dump($mailer->errors);
        dump($mailer->transactions);
        die();
    }
here is what it says:
FAILED user/pass

Array
(
[0] => Array
(
[num] => 0
[time] => 0.10932300 1164831287
[message] => MTA Error (Swift was expecting response code 250 but got 0):
)

[1] => Array
(
[num] => 0
[time] => 0.11196000 1164831287
[message] => The MTA doesn't support any of Swift's loaded authentication mechanisms
)

)

Array
(
[0] => Array
(
[command] =>
[time] => 0.10857900 1164831287
[response] =>
)

[1] => Array
(
[command] => HELO 208.106.197.72

[time] => 0.10924100 1164831287
[response] =>
)

)
Can you help me, oh great author?
whitewindow
Forum Newbie
Posts: 2
Joined: Wed Nov 29, 2006 2:23 pm

Post by whitewindow »

Hallo

FAILED user/pass

have you set the your smpt server and the right user/pass?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

its the right user/pass. the line:

echo 'FAILED user/pass';

is why it says that just for my own sanity so i knew which place it failed at. it fails to authenticate and spits out that.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

From those dumps you've sent it doesn't even get as far as asking to authenticate :( In fact, it doesn't get anything at all. It says "Hi" and nobody shouts back.... Swift is talking to itself :P

It's not connected by the time you do authenticate(). Is this a shared host blocking traffic?

Well, actually, the weird thing is that it looks like fsockopen() has opened a connection yet no data actually gets sent over it. Very odd.

What does the following code give you?

Code: Select all

<?php

$conn = fsockopen($your_host, 25, $errno, $errstr, 10);

echo "Errors: ". $errno . " => " . $errstr . "<br />";

var_dump($conn);

echo "Greeting: " . fgets($conn);
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

I swear, it will be this mindless stress that will force me to end my life. I got it working, it was all my fault and swift worked just fine. *sigh*
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

shiznatix wrote:I swear, it will be this mindless stress that will force me to end my life. I got it working, it was all my fault and swift worked just fine. *sigh*
Just curious, what was the problem if you don't mind me asking. It's useful to know this stuff, no matter how obvious it may seem because I can put hints in the FAQ :)
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

correctly spell the address of your mail server. put that one in the 'helpful hints' section :lol:
Post Reply