authenticating troubles

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
ricnut
Forum Newbie
Posts: 10
Joined: Tue Nov 21, 2006 12:44 am

authenticating troubles

Post by ricnut »

I'm using the latest swiftmail.
I had it doing all kinds of cool stuff on hostgator.com server, but then the fun came to a hault.
I can no longer send emails out to place like hotmail and lycos mail.
When I setup outlook they required I check "my server requires authentification" the settings are the same as my incoming settings, and they require you use port 26 instead of 25.
this is all working fine.

<?php


require_once "lib/EasySwift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once 'lib/Swift/Authenticator/PopB4Smtp.php';

$smtp->attachAuthenticator(new Swift_Authenticator_PopB4Smtp("pop.shasheenmachine.com"));
$smtp->setUsername("me@shasheenmachine.com");
$smtp->setPassword("me_password");



$swift =& new Swift(new Swift_Connection_SMTP("mail.shasheenmachine.com"));



it's parcing the scripts for sure. here is my error:

Fatal error: Call to a member function on a non-object in /home/me/public_html/checkout.php on line 8


line 8 being - $smtp->attachAuthenticator(new Swift_Authenticator_PopB4Smtp("pop.shasheenmachine.com")); I've changed this to mail.shasheenmachine.com and I've tried changing the username to my account username instead of email address. I don't have any more ideas.

I need this to work because my form sends a sales reciept to clients outside the hostgator realm.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: authenticating troubles

Post by Chris Corbyn »

Where did $smtp appear from?

Code: Select all

<?php
 
 
require_once "lib/EasySwift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once 'lib/Swift/Authenticator/PopB4Smtp.php';
 
$smtp =& new Swift_Connection_SMTP("mail.shasheenmachine.com");
$smtp->attachAuthenticator(new Swift_Authenticator_PopB4Smtp("pop.shasheenmachine.com"));
$smtp->setUsername("me@shasheenmachine.com");
$smtp->setPassword("me_password");
 
$swift =& new Swift($smtp);
;)

If you're not using EasySwift don't include it (in fact, don't use it anyway :P). If you're not using PHP4 the ampersands don't need to be there neither.
ricnut
Forum Newbie
Posts: 10
Joined: Tue Nov 21, 2006 12:44 am

Re: authenticating troubles

Post by ricnut »

Same message is returning. I recently recieved a lobotomy so I'm going to need you again.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: authenticating troubles

Post by Chris Corbyn »

You're getting that same error with the code I posted? :?
Fatal error: Call to a member function on a non-object in /home/me/public_html/checkout.php on line 8
Post what you've done please, it's not possible to get that error if you've read my code properly, otherwise it's a different error or you've not changed your code accordingly. Note that I *created* the $smtp variable in my version; your version was never creating it.
ricnut
Forum Newbie
Posts: 10
Joined: Tue Nov 21, 2006 12:44 am

Re: authenticating troubles

Post by ricnut »

Sorry I missed the variable. I recieved a bunch of new errors

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/ricnut/public_html/ricnut/lib/Swift/Authenticator/PopB4Smtp/Pop3Connection.php on line 129

Warning: fsockopen() [function.fsockopen]: unable to connect to pop.shasheenmachine.com:110 in /home/ricnut/public_html/ricnut/lib/Swift/Authenticator/PopB4Smtp/Pop3Connection.php on line 129

Fatal error:
Uncaught Error of type [swift_connectionexception] with message [The POP3 connection failed to start. The error string returned from fsockopen() is [Success] #0]
@0 swift::swift() in /home/ricnut/public_html/ricnut/checkout.php on line 12
@1 swift::connect() in /home/ricnut/public_html/ricnut/lib/Swift.php on line 109
@2 swift::handshake() in /home/ricnut/public_html/ricnut/lib/Swift.php on line 230
@3 swift_connection_smtp::postconnect() in /home/ricnut/public_html/ricnut/lib/Swift.php on line 286

in /home/ricnut/public_html/ricnut/lib/Swift/Errors.php on line 99

below is my checkout.php file line 12

Code: Select all

 
require_once "lib/EasySwift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once 'lib/Swift/Authenticator/@PopB4Smtp.php';
 
$smtp =& new Swift_Connection_SMTP("mail.shasheenmachine.com");
$smtp->attachAuthenticator(new Swift_Authenticator_PopB4Smtp("pop.shasheenmachine.com"));
$smtp->setUsername("me@shasheenmachine.com"); 
$smtp->setPassword("me_PASSWORD"); 
 
 
$swift =& new Swift($smtp);
 
 
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: authenticating troubles

Post by EverLearning »

From what I can tell from errors you posted, it seems that the host your're trying to connect to isn't available at the moment. Check to see that your settings are right.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: authenticating troubles

Post by Chris Corbyn »

EverLearning wrote:From what I can tell from errors you posted, it seems that the host your're trying to connect to isn't available at the moment. Check to see that your settings are right.
Indeed. PHP's fsockopen() function is throwing the error ;)
Post Reply