Page 1 of 2

The MTA doesn't support any of Swift's loaded authen[...]

Posted: Fri Nov 24, 2006 12:58 pm
by DaveTheAve
The MTA doesn't support any of Swift's loaded authentication mechanisms
Alright, cool; this is a normal SMTP/POP3 server, why am I getting this?

Code: Select all

require_once('Swift.php');

$UseMail = false;
$host = 'mail.neoeliteusa.com';
$port = '25';
$SMTPAuth = true
$username = 'David@NeoeliteUSA.com';
$password = '(You Wish)';


/* Emailier Settings */
if($UseMail === true) {
	require_once('Swift/Connection/NativeMail.php');
	$swift_mailer = new Swift(new Swift_Connection_NativeMail);
}else{
	require_once('Swift/Connection/SMTP.php');
	$swift_mailer = new Swift(new Swift_Connection_SMTP($host,$port));
	
	if($SMTPAuth === true)
		if (!$swift_mailer->authenticate($username, $password)){
			trigger_error(_SMTP_AUTH_FAILED,E_USER_ERROR);
		}
}
Anything you notice is wrong? Using version 2.1.17 on a Apache2/PHP5 windows system.

Posted: Fri Nov 24, 2006 3:57 pm
by Chris Corbyn
Is the library still in-tact or did you just copy a few files out of it? It needs to stay in-tact.

Next, send the output of print_r($mailer->transactions)... it's either using some unusual method for authentication, or it's hidng the fact that it supports authentication.

Posted: Fri Nov 24, 2006 4:05 pm
by DaveTheAve

Code: Select all

Array (
    [0] => Array ( 
            [command] => 
            [time] => 0.50354800 1164405832 
            [response] => 220 st112.startlogic.com ESMTP 
        ) 
    [1] => Array (
            [command] => EHLO 127.0.0.1 
            [time] => 0.99336000 1164405832 
            [response] => 250-st112.startlogic.com 250-PIPELINING 250 8BITMIME 
        ) 
)
Well, the hidden server was picked up. mail.neoeliteusa.com is runs off the st112.startlogic.com server.

Posted: Fri Nov 24, 2006 4:17 pm
by Chris Corbyn
Sorry I didn't mean the server is hidden. I meant, SMTP server are supposed the advertise what authentication methods they support. According to RFC 2554:
3. The Authentication service extension

(1) the name of the SMTP service extension is "Authentication"

(2) the EHLO keyword value associated with this extension is "AUTH"

(3) The AUTH EHLO keyword contains as a parameter a space separated
list of the names of supported SASL mechanisms.
Unless the server has provided such a list, Swift cannot know what methods are safe to try. I'll include a manual override in version 3, but I have to ask, are you 100% sure you need to authenticate? A server usually would not support authentication if it doesn't say it does, but you can configure the server to display what list it likes in theory.

It should have looked something like:

Code: Select all

250-st112.startlogic.com
250-PIPELINING
250-AUTH PLAIN LOGIN CRAM-MD5
250 8BITMIME
I can provide a hack in this thread to make it work with version 2 if needs be :)

Posted: Fri Nov 24, 2006 4:25 pm
by DaveTheAve
No i'm not sure at all if i need to login to the server to SEND (SMTP) mail; however, I always assumed you did because i always need to auth to fetch mail (POP3).

/me tests without auth....

Well i'll be damned... all that to find out I don't need auth... i'm really sorry about that. Thank you.

Posted: Fri Nov 24, 2006 4:29 pm
by Chris Corbyn
DaveTheAve wrote:No i'm not sure at all if i need to login to the server to SEND (SMTP) mail; however, I always assumed you did because i always need to auth to fetch mail (POP3).

/me tests without auth....

Well i'll be damned... all that to find out I don't need auth... i'm really sorry about that. Thank you.
You always need to log in to read mail just so it knows who you are and who's messages to dish out (as well as the security of it). Sending mail is different though. It a one-way procedure which doesn't divulge personal information to anybody. It's inherently insecure and that's well known about SMTP. More useful than authentication are things like SPF which work at a DNS level :)

Ignore me, I'm rambling again, glad you got it working.

Posted: Fri Nov 24, 2006 5:22 pm
by DaveTheAve
Sorry, the only reason I assumed it required me to login was because I would have never guessed it was THAT insecure.

Mailer Error: didn´t authenticate to server

Posted: Sat Dec 30, 2006 1:06 pm
by hjklmn
Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi,

   am using swift mailer to send mail for my host:mail.hostname.com..
i also include username and password in the code..but, still am getting the error:  
"Didn´t authenticate to server"..here is my code:

Code: Select all

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

if(isset($_POST['Submit']))
{
 $mailer = new Swift(new Swift_Connection_SMTP('mail.hostname.com'));

if ($mailer->isConnected()) 
{
 if ($mailer->authenticate('username', 'password'))
 {
		//Sends a simple email
		$mailer->send('recipient@gmail.com', 'sender@gmail.com', 'hi', 'test mail');
 }
	else echo "Didn't authenticate to server";
	$mailer->close();
}
 else echo "The mailer failed to connect. Errors: <pre>".print_r($mailer->errors, 1)."</pre><br />
	Log: <pre>".print_r($mailer->transactions, 1)."</pre>";
}
thanks in advance...


Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sat Dec 30, 2006 3:17 pm
by Chris Corbyn
Can you show us what print_r($mailer->transactions) gives you?

Also, I assume all the files are still where they were when you extracted the archive? :)

swift mailer error

Posted: Sun Dec 31, 2006 3:46 am
by hjklmn
thanks for ur reply..

i din get the $print_r->transactions error..one thing is that the code executes when i send to other mails except in the case that it doesn't receive mail only to gmail id.. so, when i send a mail to my gmail id..i simply get the error:

Didn´t authenticate to server

what could be the problem in sending mail to gmail?..

Posted: Sun Dec 31, 2006 4:43 am
by Chris Corbyn
Show some code. Also, what version of PHP do you have?

Gmail *requires* TLS to be used. TLS is a sort of encryption and not all PHP installations have been compiled with support for it.

Posted: Sun Dec 31, 2006 6:38 am
by hjklmn
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i am using php 5.1.1 version..also, i enabled ssl extension and restarted IIS..i am sure that i also copied the swiftmailer files in the right path..I checked the phpinfo()..the ssl information appears..

this is my sample code..

Code: Select all

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

if(isset($_POST['Submit'])) 
{ 
 $mailer = new Swift(new Swift_Connection_SMTP('mail.hostname.com')); 

if ($mailer->isConnected()) 
{ 
 if ($mailer->authenticate('username', 'password')) 
 { 
         $mailer->send('recipient@gmail.com', 'sender@gmail.com', 'hi', 'test mail'); 
 } 
        else echo "Didn't authenticate to server"; 
        $mailer->close(); 
} 
 else echo "The mailer failed to connect. Errors: <pre>".print_r($mailer->errors, 1)."</pre><br /> 
        Log: <pre>".print_r($mailer->transactions, 1)."</pre>"; 
} 
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Dec 31, 2006 7:19 am
by Chris Corbyn
Oh I see, you're sending email to Gmail, not from Gmail. Does your server actually require authentication? What happens if you do it without authentication?

I still need to see a dump of $mailer->transactions.... it's not error info, it's debug info for me ;)

Posted: Sun Dec 31, 2006 7:53 am
by hjklmn
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


If i send an email to gmail without authentication connecting through my host, i get the following errors...


The mailer failed to connect. Errors:

Code: Select all

Array
(
    [0] => Array
        (
            [num] => -1
            [time] => 0.80415700 1167573080
            [message] => Send Error: Sending to 1 recipients rejected (bad response code).
        )

    [1] => Array
        (
            [num] => 0
            [time] => 0.80425200 1167573080
            [message] => Sending failed on command: RCPT TO: 

        )

)


Log: 
Array
(
    [0] => Array
        (
            [command] => 
            [time] => 0.91292300 1167573079
            [response] => 220 mail44.opentransfer.com ESMTP

        )

    [1] => Array
        (
            [command] => EHLO localhost

            [time] => 0.18241800 1167573080
            [response] => 250-mail44.opentransfer.com
250-PIPELINING
250-8BITMIME
250 SIZE 1048576000

        )

    [2] => Array
        (
            [command] => MAIL FROM: 

            [time] => 0.39021400 1167573080
            [response] => 250 ok

        )

    [3] => Array
        (
            [command] => RCPT TO: 

            [time] => 0.59890400 1167573080
            [response] => 553 sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)

        )

    [4] => Array
        (
            [command] => RSET

            [time] => 0.80370500 1167573080
            [response] => 
        )

)

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Dec 31, 2006 8:23 am
by feyd
hjklmn, please use the syntax highlighting tags we have provided our users.