Overview
Features
Download
Documentation
Community
Add-Ons & Services

SMTP don't work

Please post support and help requests here.

SMTP don't work

Postby batori » 14 Apr 2008, 21:27

Hi,

I'm trying to send a e-mail from my application and based on samples* I'm using that way:

* = poco-1.3.1-ssl/Net/samples/Mail/src/Mail.cpp


Code: Select all

   try {
      MailMessage message;
      message.setSender("valentim@batori.com.br");
      message.addRecipient(MailRecipient(MailRecipient::PRIMARY_RECIPIENT, "valentim@batori.com.br"));
      message.setSubject("Test Message");

      Timestamp ts(0);
      message.setDate(ts);

      std::string content;
      content += "Hello Rodrigo";
      content += ",

";
      content += "This is a greeting from the C++ Portable Components.

";
      message.addContent(new StringPartSource(content));

//POP3ClientSession sessionPop("pop.batori.com.br");
//sessionPop.login("valentim@batori.com.br", "password");
//sessionPop.close();

      SMTPClientSession session("smtp.batori.com.br");
//      session.login();
      session.login("192.168.1.64");
      session.sendMessage(message);
      session.close();

//sessionPop.close();
      } catch (SMTPException&) {
      } catch( Exception& exc ) {
         std::cerr << exc.displayText() << std::endl;
      }



I try all possible combinations with and without the comments parts and I always get:
SMTP server response: 501 Syntax error in parameters or arguments


So I used Wireshark to sniffer and compare Thunderbird send message with Poco and I saw that there is a "AUTH PLAIN" difference and I want to know how can I send e-mail from Poco, or how to correct that problem, that I'm thinking is something with authentication (we don't use neither TLS nor SSL).


Look the result from both:

Code: Select all

POCO
220 mustang.batori.com.br Firewall Aker Proxy SMTP
EHLO 192.168.1.64
250-mustang.batori.com.br Ola [192.168.1.64]
250-AUTH LOGIN PLAIN
250 AKER_NO_MORE_CAPABILITIES
MAIL FROM:
250 ... Emissor ok
RCPT TO:
501 Erro de sintaxe nos parametros do comando
QUIT


Thunderbird
Code: Select all

220 mustang.batori.com.br Firewall Aker Proxy SMTP
EHLO [192.168.1.64]
250-mustang.batori.com.br Ola [192.168.1.64]
250-AUTH LOGIN PLAIN
250 AKER_NO_MORE_CAPABILITIES
AUTH PLAIN AHZhbGVudGltQGJhdG9yaS5jb20uYnIAYmF0b3JpMDA1NTg=
235 AUTH OK
MAIL FROM:
250 ... Emissor ok
RCPT TO:
250 valentim@batori.com.br... Recipiente ok
DATA
354 Entre os dados; termine com uma linha com apenas o "." como caractere
Message-ID: <4803439E.9000709@batori.com.br>
Date: Mon, 14 Apr 2008 11:44:30 +0000
From: "Rodrigo F. Valentim"
User-Agent: Thunderbird 2.0.0.9 (X11/20071031)
MIME-Version: 1.0
To: Eu
Subject: Teste
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Teste OK
.
250 OK
QUIT
221 mustang.batori.com.br fechando a conexao


Thanks for any help.
batori
 
Posts: 4
Joined: 12 Dec 2007, 21:18

Re: SMTP don't work

Postby guenter » 15 Apr 2008, 11:53

It seems that your SMTP server requires authentication, which is currently not supported by POCO. However, I have some patches at hand that implement AUTH LOGIN and AUTH CRAM-MD5 in SMTPClientSession. I will put them into the SVN trunk later today.
guenter
 
Posts: 1138
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron