Swift Mailer Support Thread (Split from Source)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Swift Mailer Support Thread (Split from Source)

Post 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.
Last edited by Chris Corbyn on Fri Jun 16, 2006 5:17 am, edited 1 time in total.
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post 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]
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Last edited by Chris Corbyn on Fri May 26, 2006 4:09 am, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Getting smtp_authentication.php to work

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Getting smtp_authentication.php to work

Post 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.
Last edited by Chris Corbyn on Wed May 24, 2006 3:58 am, edited 1 time in total.
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post 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?
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post 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)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post 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!"
		);
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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? :)
Locked