[SOLVED] Problems with argosoft mail server

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
ezar
Forum Newbie
Posts: 2
Joined: Fri Mar 30, 2007 8:00 am

[SOLVED] Problems with argosoft mail server

Post by ezar »

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]


Hi, 
Thnak you for swiftmailer  Its a nice applicacion... 
I have problems when send an email to a Argosoft SMTP server...

I solved using:
1. I need to add $smtp->setExtension("AUTH", array("LOGIN")); in connect mode.
2. I need to modify $this->command("EHLO " . $this->domain, 250); to force EHLO command... If I use HELO dont work...
With these changes all works... but I need to modify swift.php

Can you review it?
Seems that if (strpos($greeting->getString(), "ESMTP")) dont work...
Argosoft returns:
   220 ArGoSoft Mail Server Freeware, Version 1.8 (1.8.8.9)
NOT ESMTP!!!
Can you add some options or...?

Code: Select all

$smtp = new Swift_Connection_SMTP($this->Host);
				$smtp->attachAuthenticator(new Swift_Authenticator_LOGIN());
				$smtp->setExtension("AUTH", array("LOGIN"));
				$smtp->setUsername($this->Username);
				$smtp->setpassword($this->Password);
 
				$this->swift = new Swift($smtp);

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

Post by Chris Corbyn »

That server is NOT follwing the RFCs. ESMTP server MUST say ESMTP in their greeting and SASL server MUST provide the list of AUTH methods they support.

But in any case, it's a complete hack, but this should get you going:

Code: Select all

<?php

require_once "lib/Swift.php";
Swift_ClassLoader::load("Swift_Connection_SMTP");
Swift_ClassLoader::load("Swift_Events_ResponseListener");

//Make a custom plugin just to hack at the responses and commands
class SayESMTP implements Swift_Events_ResponseListener {
  public function responseReceived(Swift_Events_ResponseEvent $e) {
    if ($e->getCode() == 220) {
      $e->setString("220 ESMTP whatever");
      $swift = $e->getSwift();
      $swift->connection->setExtension("AUTH", array("LOGIN"));
    }
  }
}

$smtp = new Swift_Connection_SMTP("server.tld");
$smtp->setUsername("user");
$smtp->setPassword("pass");

//Force swift to wait for us to load a plugin
$swift = new Swift($smtp, null, Swift::NO_START);
$swift->attachPlugin(new SayESMTP(), "hack");

//Now connect
$swift->connect();

//and continue as usual

$swift->send( .... );
Like I say, it's a complete hack, and Argosoft's server should not be doing that. RFCs are put in place for a reason, why Argosoft are not using them I have no idea. They are leaving any connecting software completely in the dark about what they can do.

I didn't test that plugin. It should work though, and if it doesn't, it's not because Swift can't do it, I've probs just made a mistake in the logic. You could totally pre-script the SMTP conversation if you really wanted to using a plugin.
ezar
Forum Newbie
Posts: 2
Joined: Fri Mar 30, 2007 8:00 am

solved

Post by ezar »

Thnak You!
I test your code but... error:

Code: Select all

[Fri Mar 30 11:11:46 2007] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'Swift_Connection_Exception' with message 'The SMTP connection is not alive and cannot be written to.' in C:\\Tomcat\\webapps\\OneFactoryTeam3\\resources\\libraries\\Swift\\lib\\Swift\\Connection\\SMTP.php:248\nStack trace:\n#0 C:\\Tomcat\\webapps\\OneFactoryTeam3\\resources\\libraries\\Swift\\lib\\Swift.php(300): Swift_Connection_SMTP->write('MAIL FROM: <bra...', '??')\n#1 C:\\Tomcat\\webapps\\OneFactoryTeam3\\resources\\libraries\\Swift\\lib\\Swift.php(373): Swift->command('MAIL FROM: <bra...', 250)\n#2 C:\\Tomcat\\webapps\\OneFactoryTeam3\\resources\\libraries\\mailserver.php(120): Swift->send(Object(Swift_Message), Object(Swift_RecipientList), Object(Swift_Address))\n#3 C:\\Tomcat\\webapps\\OneFactoryTeam3\\resources\\libraries\\sendmail_form.php(45): swiftserver->Send_Mail('teteteet', 'fkhdjfhfdsfsgfs...', Array)\n#4 {main}\n  thrown in C:\\Tomcat\\webapps\\OneFactoryTeam3\\resources\\libraries\\Swift\\lib\\Swift\\Connection\\SMTP.php on line 248, referer: http://localhost:81/OneFactoryTeam3///resources/libraries/sendmail.php
I forgot connect :(
Work now :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The plugin worked? Sweet :) I shall pat myself on the back... wait... I shall grab myself a beer! I wrote it directly in the thread so I expected it to break in some fashion or other on first run.

I still have no idea why Argosoft would defy the RFCs though. It's not even as if they may be unaware of the relevant bits of the RFCs, it's pretty much standard issue that the SMTP server tells you all about itself when you connect and say "Yo dude" to it.

(That beer's going to my head, so I'll shut up!)
Post Reply