Page 1 of 6

Swift Mailer Support Thread (Split from Source)

Posted: Sun May 21, 2006 8:21 am
by Chris Corbyn
NOTE: This thead has been split from it's original thread here: viewtopic.php?t=48055

Note: 0.0.4 added.

Just a note about forthcoming features - maybe a month or two away yet though:

Built-in changes:

*Much faster* handling of BCC, CC [Done & tested, 22nd May 2006!]
New encoding types; binary, utf8
TLS Support (Gmail servers!!)
Embedded images
More concise error codes

Bundled plugins being added:

Auto-reconnect on failure
Unlimited redundant SMTP connections [Done & tested, 22nd May 2006!]
(Possibly) Multiple simultaneous connections - likely not possible with PHP alone
Die verbosely on error (Swift dies quietly by default)
Logger (XML, Database (Mysql), Flat-file (default comma separated, changeable))
(Possibly) Dummy test for spam scoring with spamassassin (you'll need perl!)

There will be an additional few small optimizations.

Posted: Mon May 22, 2006 8:04 pm
by akreider
Pimptastic | 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'm having trouble getting this to work.

I tried basic_sendmail.php.

It enters this section (echoes "entering mailer" correctly), and doesn't give any kind of error message. But I don't get an email sent to my address.

Code: Select all

if (!$mailer->hasFailed())
{
	echo ("entering mailer");
	//Sends a simple email
	$mailer->send(
		'"Aaron" <aaron@campusactivism.org>',
		'"Your name" <you@yourdomain.com>',
		'Some Subject',
		"Hello Joe it's only me!"
	);
	//Closes cleanly... works without this but it's not as polite.
	$mailer->close();
}

I also tried smtp_authentication.php. Entered the username and password for my account on the Verizon smtp server (Verizon is my ISP) - outgoing.verizon.net. It gave me a "Didn't authenticate to server" error. I used the same username and password that work with my Verizon server for sending email.

I'm using php 4. Shared hosting plan.

Any suggestions?

Aaron


Pimptastic | 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: Mon May 22, 2006 9:07 pm
by RobertGonzalez
This thing looks tight d11. I can't wait to try it out. I am developing a network of sites for a swim team locally and they are using Yahoo Groups' listserv right now. I love to get this thing in action as a communication system (so as to toot your horn for you a tad). :wink:

Posted: Tue May 23, 2006 3:11 am
by Chris Corbyn
Remove the line that calls $mailer->loadAuthenticator(). There's actually some auto-loading that will occur in the background if you don't call that line (sorry not documented yet :-\ ) You'' have 3 different authentication options this was as opposed to just the one.

Try it again after that. If the username and password you're using is just for the hosting it may not neccessarily be for SMTP authentication too (sorry to sound patronising) and it may just work without authenticating at all. Sorry I forgot if you mention if this is a windows or linux server, if it's linux use the sendmail connection, it's much faster and less restrictive because it runs locally.

EDIT | Can you provide me with a print_r() of $mailer->transactions after you call close() as well please... it should make it really clear where the problem lies.

Posted: Tue May 23, 2006 9:39 am
by Chris Corbyn
Yikes.... I just tested the new version (unreleased) with a few things trimmed down and had it send 100 *unique* emails to my own domain using the sendmail connection (removing the network connection overhead) and it took 3.7 seconds to get them all in the mail spool 8O. Excuse my pointless post :P

Getting smtp_authentication.php to work

Posted: Tue May 23, 2006 7:43 pm
by akreider
d11wtq wrote: Remove the line that calls $mailer->loadAuthenticator(). There's actually some auto-loading that will occur in the background if you don't call that line (sorry not documented yet :-\ ) You'' have 3 different authentication options this was as opposed to just the one.

Try it again after that. If the username and password you're using is just for the hosting it may not neccessarily be for SMTP authentication too (sorry to sound patronising) and it may just work without authenticating at all. Sorry I forgot if you mention if this is a windows or linux server, if it's linux use the sendmail connection, it's much faster and less restrictive because it runs locally.

EDIT | Can you provide me with a print_r() of $mailer->transactions after you call close() as well please... it should make it really clear where the problem lies.
I removed the line. It still doesn't work.

print_r of $mailer->transactions gives an empty array() .

I've got Linux running PHP as CGI. I'm not sure if that or any other weird permissions stuff could affect this? I'm not an expert on permissions. I know that the mail() function works. My host may have restricted the permissions for the PHP user.

Username/password are for my ISP. My host is a different company.


After removing the one line, I get an error when I try to debug it (using Zend Studio) - but this error doesn't appear when I run it on my local apache server.
Debug Error: C:\webserve\eactobj\standalone\Swift-0.0.4-php4\Swift\Swift_LOGIN_Authenticator.php line 44 - Cannot redeclare class swift_login_authenticator

I got rid of this error by commenting out the first require('../../Swift/Swift_LOGIN_Authenticator.php');
And it still didn't work. The $mailer->transactions is still an empty array

Re: Getting smtp_authentication.php to work

Posted: Wed May 24, 2006 2:34 am
by Chris Corbyn
In which case it's failing to even connect to the SMTP server because at the very least there should be handshake in the log.... you can PM me the code you're using if you like. Try using telnet to connect to the SMTP server on port 25 from the same server. PHP needs fsockopen() for this to work too - although it's unlikely you don't have that.

Posted: Wed May 24, 2006 3:11 am
by akreider
I've been trying this two places

1) on my local pc, runs windows xp, and a local apache server.

2) on my shared-hosting plan.


From my local computer I can telnet to outgoing.verizon.net 25.

From my shared hosting plan it doesn't connect. It says "connection refused". Could they be black-listing my hosting company?

Posted: Thu May 25, 2006 2:40 am
by akreider
Ok, we fixed some PHP 4 bug. Now I'm getting and Unknown MAIL FROM parameter error message when I try it with outgoing.verizon.net. I've occasionally read that verizon only accepts email from @verizon.net accounts. However I tried it with an @verizon.net account and it didn't work.

This is print_r($mailer->transactions)

Code: Select all

X-Powered-By: PHP/4.4.1
Content-type: text/html

Array
(
    [0] => Array
        (
            [command] => 
            [time] => 0.86916800 1148542498
            [response] => 220 vms042pub.verizon.net -- Server ESMTP (Sun Java System Messaging Server 6.2-4.02 (built Sep  9 2005))

        )

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

            [time] => 0.04218100 1148542499
            [response] => 250-vms042pub.verizon.net
250-8BITMIME
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-HELP
250-XLOOP EF1F1B2865031BD3EA25D4A94279C48C
250-AUTH PLAIN LOGIN
250-AUTH=LOGIN
250-ETRN
250-NO-SOLICITING
250 SIZE 20971520

        )

    [2] => Array
        (
            [command] => AUTH LOGIN

            [time] => 0.13603200 1148542499
            [response] => 334 VXNlcm5hbWU6

        )

    [3] => Array
        (
            [command] => fgsdhsfvstsre

            [time] => 0.22908500 1148542499
            [response] => 334 UGFzc3dvcmQ6

        )

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

            [time] => 0.32310400 1148542499
            [response] => 235 2.7.0 LOGIN authentication successful.

        )

    [5] => Array
        (
            [command] => mail from: "Aaron Kreider" <seacdsl@verizon.net>

            [time] => 0.41716600 1148542499
            [response] => 555 5.5.4 Unknown MAIL FROM parameter <seacdsl@verizon.net>.

        )

)
However, it works with another SMTP server that I have access to. So this must be a Verizon issue.

d11wtq | Editted post to remove username and password (nobody prob noticed but they are only base64 encoded)

Posted: Thu May 25, 2006 2:46 am
by Chris Corbyn
That's already been fixed in Version 1.0. There are only a handful of servers that won't accept that address notation.

I wasn't going to release version 1 yet but I'll put it up shortly and add the additional features to future releases.

Posted: Thu May 25, 2006 2:56 am
by akreider
I figured out the Verizon problem.

Verizon works if you take out the part in double quotes.

So this works:

Code: Select all

$mailer->send(
  '<aaron@campusactivism.org>',
  '<seacdsl@verizon.net>',
  'Some Subject',
  "Hello Joe it's only me!"
		);
But this won't work:

Code: Select all

$mailer->send(
  '"Aaron Kreider"<aaron@campusactivism.org>',
  '"Joe Spammer"<seacdsl@verizon.net>',
  'Some Subject',
  "Hello Joe it's only me!"
		);

Posted: Thu May 25, 2006 3:10 am
by Chris Corbyn
Version 1.0 strips out the name and puts a raw email address in for the MAIL and RCPT commands, it won't change your email headers though ;)

Release will be later today.

Posted: Thu May 25, 2006 4:05 am
by Chris Corbyn
I've just packaged what there is of 1.0.0.

Check the first post in this thread for the updated links and Changes.

Posted: Thu May 25, 2006 5:21 pm
by akreider
I'm getting very mixed results. Do you think Verizon might be blocking my emails from my domain? I've only sent perhaps 100 emails using their service, and the largest batch would be under 50.

I can get the SMTP authenticated version to work when I run it on my local PC.

But when I run it on my server, I get the following error message:

Errors: Array ( [0] => Array ( [num] => 0 [time] => 0.39859900 1148595415 [message] => Connection to the given MTA failed ) ) . Log: Array ( )

It was working yesterday on my server (running version 0.0.4). I tried it with both versions (0.0.4 and 1.0.0) and get the same results.

FYI: it takes about 0.5 seconds/email when it works.

Posted: Thu May 25, 2006 5:54 pm
by Chris Corbyn
The time per email you see is network traffic if you're using the SMTP connection. It's been tested with the sendmail connection to be massively faster and the only real difference is the network not being used. If the production server runs linux I strongly advise using sendmail instead of remote SMTP. The mails will not be delivered instantly but they will queue on the mail spool which is good since it's left PHP's hands.

As for verizon connection issues. If it's not connecting from one place but it is from another I'm not sure what could cause that I'm afraid. If I'm understanding you correctly you can't telnet to the server neither - can I just clarify that so that? :)