OpenWrt Forum Archive

Topic: sendmail voicemail error

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I have 1 error :

<<<< 220 smtp6-g19.free.fr ESMTP Postfix
>>>> HELO OpenWrt
<<<< 250 smtp6-g19.free.fr
>>>> MAIL FROM:<Asterisk-Pbx@free.fr>
<<<< 250 Ok
>>>> RCPT TO:<"Yannick Mailbox" <yann78essai@free.fr>
<<<< 501 Bad recipient address syntax
/mnt/sd/usr/sbin/sendmail: unexpected response 501 to RCPT TO command

Why?

Can you help me?

yann78 wrote:

>>>> RCPT TO:<"Yannick Mailbox" <yann78essai@free.fr>

Count the number of brackets <,> and you'll notice that there is a formatting error in the mail address...
I would suggest to leave out the "name" part completely.

Hans.

zandbelt wrote:
yann78 wrote:

>>>> RCPT TO:<"Yannick Mailbox" <yann78essai@free.fr>

Count the number of brackets <,> and you'll notice that there is a formatting error in the mail address...
I would suggest to leave out the "name" part completely.

Hans.

With voicemail.conf :

[default]                                                                                                 
5623 => 5421,Yannick Mailbox,yann78essai@free.fr
 
I have this error:
   <<<< 220 smtp6-g19.free.fr ESMTP Postfix
   >>>> HELO OpenWrt
   <<<< 250 smtp6-g19.free.fr
   >>>> MAIL FROM:<Asterisk-Pbx@free.fr>
   <<<< 250 Ok
   >>>> RCPT TO:<"Yannick Mailbox" <yann78essai@free.fr>
   <<<< 501 Bad recipient address syntax
   /mnt/sd/usr/sbin/sendmail: unexpected response 501 to RCPT TO command

And with voicemail.conf :

default]                                                                                                 
5623 => 5421,,yann78essai@free.fr
 
I have this error:
   <<<< 220 smtp6-g19.free.fr ESMTP Postfix
   >>>> HELO OpenWrt
   <<<< 250 smtp6-g19.free.fr
   >>>> MAIL FROM:<Asterisk-Pbx@free.fr>
   <<<< 250 Ok
   >>>> RCPT TO:<"" <yann78essai@free.fr>
   <<<< 501 Bad recipient address syntax
   /mnt/sd/usr/sbin/sendmail: unexpected response 501 to RCPT TO command


Can you help me ?


Is there an error in the sendmail.c file?

_________________________________________________________________________
static void
add_recipient( char* recipient, int len )
    {
    char buf[1000];
    int status;

    /* Skip leading whitespace. */
    while ( len > 0 && ( *recipient == ' ' || *recipient == '\t' ) )
    {
    ++recipient;
    --len;
    }

    /* Strip off any angle brackets. */
    while ( len > 0 && *recipient == '<' )
    {
    ++recipient;
    --len;
    }
    while ( len > 0 && recipient[len-1] == '>' )
    --len;

    (void) snprintf( buf, sizeof(buf), "RCPT TO:<%.*s>", len, recipient );
    send_command( buf );
    status = read_response();
    if ( status != 250  && status != 251 )
    {
    (void) fprintf(
        stderr,  "%s: unexpected response %d to RCPT TO command\n",
        argv0, status );
    exit( 1 );
    }
    got_a_recipient = 1;
    }
___________________________________________________________________________

What is the commandline for sending mail in the voicemail.conf?
Which sendmail package do you use (I recommend ssmtp)?
What does the configuration file for the sendmail package look like?

Hans.

zandbelt wrote:

What is the commandline for sending mail in the voicemail.conf?

mailcmd=/mnt/sd/usr/sbin/sendmail -t -fAsterisk-Pbx@free.fr -ssmtp.free.fr -p25 -v



zandbelt wrote:

Which sendmail package do you use (I recommend ssmtp)?

http://downloads.openwrt.org/backports/ … mipsel.ipk



zandbelt wrote:

What does the configuration file for the sendmail package look like?

FILES  Makefile   mini_sendmail.c    mini_sendmail.8     version.h

Can you help me ?

Hello Yann,

I had the same problems (with WR RC6) until i removed completely the names from the voicemail.conf file.
It seems that mini-sendmail has a problems with the destination user address if it includes the user name.
Removing the user name from voicemail.conf solves the problem. Still works with WR 0.9 ...

Noel
Montreal, Canada

Update ...

I just upgraded to asterisk 1.4 (from 1.2.14) and i now have also the same (or similar) problem ...:
>>>> MAIL FROM:<root@OpenWrt>
<<<< 250 2.1.0 <root@OpenWrt>... Sender ok
>>>> RCPT TO:<"" <noel201@teledata.qc.ca>
<<<< 553 5.0.0 <"" <noel201@teledata.qc.ca>... Unbalanced '<'

I used the same sendmail cmd and voicemail.conf settings as before
201 => 201,,noel201@telexxxx.qc.ca,,attach=yes|saycid=no|envelope=no|delete=no
mailcmd=/usr/sbin/mini_sendmail -t -v -smailxxx.xxx.com
Note the blank 2nd param in the voicemail.conf (this fixed the problem in 1.2.14 ...) no it doesn't anymore :-(

So ... there must be a problem in the way * format the parameters from the conf. files ...

Any tought zandbelt ????
Tnx for any help ...

Noël

(Last edited by noelbou on 7 Apr 2007, 16:03)

Try and debug the actual message sent using:

   mailcmd=cat \> /tmp/astvm-mail

Hans.

PS: it looks like asterisk 1.4.x and mini_sendmail have some interoperability issues (ssmtp works fine with 1.4.x)

zandbelt wrote:

Try and debug the actual message sent using:
   mailcmd=cat \> /tmp/astvm-mail

Sorry .. but thi cmd doesn't work ... No such file ...  (?)
Tried a few variations with same result ...

Noël

zandbelt wrote:

PS: it looks like asterisk 1.4.x and mini_sendmail have some interoperability issues (ssmtp works fine with 1.4.x)

with sd/card ?

ssmtp dosn't work : segmentation fault

(Last edited by yann78 on 7 Apr 2007, 18:52)

Update:

I had to go back to * 1.2.14 as my WRTSL54GS would not reboot after updating to V1.4 :-(

Here is what * sends to mini-sendmail (this seems perfect ...)

Date: Sat, 07 Apr 2007 17:37:06 +0000
From: Asterisk PBX <asterisk@OpenWrt>
To: Noel Bouchard <noel201@telxxxxx.ca>
Subject: Nouveau message (10) Boîte Vocale: 201
Message-ID: <Asterisk-9-404370704-201-2052@OpenWrt>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="voicemail_920120521945708878"

+----------------------------------------+

Reply from mini_sendmail:

>>>> MAIL FROM:<root@OpenWrt>
<<<< 250 2.1.0 <root@OpenWrt>... Sender ok
>>>> RCPT TO:<Noel Bouchard <noel201@teledata.qc.ca>
<<<< 553 5.0.0 <Noel Bouchard <noel201@teledata.qc.ca>... Unbalanced '<'
/usr/sbin/mini_sendmail: unexpected response 553 to RCPT TO command

+------------------------------------------------------+

If i do not put a name in the voicemail.conf 201 => 201,, ...  the problem does not occur ...
So i guess you are right ... the problem is with mini-sendmail ...
But ... there must be some diffs. in * 1.4 as it seemed that
not including the name would not solve the problem ???

+----------------------------------------+

On the V 1.4 issue ... it is strange as it ran ok after i updated until next reboot ...
which did not terminate ...  (no http/ ssh ... had to access in fail-safe mode) ...
Then i did mount_root and tried to start everything "manually" and everything seemed
to start ok (???). Asterisk started ok ...
Could it be a memory problem ... ? i.e. i have exeeded the RAM capacity ???

I noticed that even with V1.1.14 the free ram was sometimes very low (< 1000)
Last question ...  what are the buffers in the free (mem) display ?

Tnx ...

Noël

zandbelt wrote:

PS: it looks like asterisk 1.4.x and mini_sendmail have some interoperability issues (ssmtp works fine with 1.4.x)

I have this error :
Server didn't accept AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first

yann78 wrote:

:
Server didn't accept AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first

This server expects a secure smtp connection on that particular port and it looks like you are trying to open a plain TCP connection instead. I assume this is ssmtp we're talking about now (or did you resolve the issue with mini-sendmail)? Here's a sample ssmtp.conf for a Gmail account which also uses secure smtp (replace <myname> and <mydomain>) :

root=<myname>@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=<mydomain>
UseSTARTTLS=YES
AuthUser=<myname>
AuthPass=****
FromLineOverride=YES
hostname=<mydomain>

Hans.

noelbou wrote:

I had to go back to * 1.2.14 as my WRTSL54GS would not reboot after updating to V1.4 :-(
...
On the V 1.4 issue ... it is strange as it ran ok after i updated until next reboot ...
which did not terminate ...  (no http/ ssh ... had to access in fail-safe mode) ...
Then i did mount_root and tried to start everything "manually" and everything seemed
to start ok (???). Asterisk started ok ...
Could it be a memory problem ... ? i.e. i have exeeded the RAM capacity ???

Eehm, I think this can be due to the /etc/default/asterisk that is provided in the package, which opens a console...
Better remove any "-c" or "-v" flags there. 1.4.x is reported to work and I'd recommend the upgrade.

Hans.

zandbelt wrote:

1.4.x is reported to work and I'd recommend the upgrade.
Hans.

I will try to give it a 2nd try later ... no more time now ...

Thank you Hans for your precious help !!!

Noël

(Last edited by noelbou on 7 Apr 2007, 20:07)

I think that indeed the problem is caused by a change in app_voicemail after asterisk 1.2.14, so it will also exist in asterisk 1.2.16 etc:
  http://svn.digium.com/view/asterisk/bra … p;view=log

I'm not sure whether this change revealed a bug in mini-sendmail or that the actual error is in asterisk (I guess I'd have to check the RFCs on that...)

To be continued,

Hans.

zandbelt wrote:
yann78 wrote:

:
Server didn't accept AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first

This server expects a secure smtp connection on that particular port and it looks like you are trying to open a plain TCP connection instead. I assume this is ssmtp we're talking about now (or did you resolve the issue with mini-sendmail)? Here's a sample ssmtp.conf for a Gmail account which also uses secure smtp (replace <myname> and <mydomain>) :

root=<myname>@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=<mydomain>
UseSTARTTLS=YES
AuthUser=<myname>
AuthPass=****
FromLineOverride=YES
hostname=<mydomain>

Hans.

With ssmtp :

1/ I installed the ssmtp_2.61-1_mipsel.ipk package 

2/ I modified the file /etc/ssmtp/ssmtp.conf :

------------------------------------------------------------
root=yann78essai@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomaine=root=yann78essai@gmail.com
UseSTARTTLS=YES
AuthUser=root=yann78essai
AuthPass=pass             (The real password)
FromLineOverride=YES
hostname= yann78essai@gmail.com
-------------------------------------------------------------


3/ I did a test : echo "test" | ssmtp -vvv yann78essai@gmail.com

And I get the following error :

[<-] 220 mx.google.com ESMTP 5sm5145240ugc
[->] EHLO yann78essai@gmail.com
[<-] 250 ENHANCEDSTATUSCODES
[->] AUTH LOGIN PG15bmFtZT4=
[<-] 530 5.7.0 Must issue a STARTTLS command first 5sm5145240ugc
ssmtp: Server didn't accept AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first 5sm5145240ugc)


Can you help me ?

yann78 wrote:

rewriteDomaine=root=yann78essai@gmail.com
...
AuthUser=root=yann78essai
...
hostname= yann78essai@gmail.com

These lines all look kind of weird; you wanna change them into something sensible...

But: I just realized that I have a custom version of ssmtp that was built with SSL support enabled.
The default package that you installed doesn't build with SSL support; I put my package at:
  http://zandbelt.dyndns.org/asterisk/ssm … mipsel.ipk
Try this one (with a corrected config file) and I'll submit the patches to the repository.

Hans.

zandbelt wrote:

I'm not sure whether this change revealed a bug in mini-sendmail or that the actual error is in asterisk (I guess I'd have to check the RFCs on that...)
...
To be continued.

The matter is the following: mini-sendmail does not work with (quoted) full names for _any_ version of Asterisk, as Noel already mentioned.
The after-1.2.14 releases have changed behaviour for the case that no name is filled in: still "" is sent to the mailer, on which mini-sendmail now chokes (as it always would have). Mini-sendmail starts stripping of the < and > brackets but in case a full name (or: "") is supplied, this removes the ending bracket, but leaves the opening bracket (since it is in the middle now, preceded by a full name). Then mini-sendmail surrounds it again with its own brackets...

Bottom line: it is a bug in mini-sendmail, which should support full names or strip them off correctly. I'll provide a fix for it shortly. In the mean time you could use the SSL-enabled version of ssmtp described in my previous post which works with full names.

Hans.

zandbelt wrote:
yann78 wrote:

rewriteDomaine=root=yann78essai@gmail.com
...
AuthUser=root=yann78essai
...
hostname= yann78essai@gmail.com

These lines all look kind of weird; you wanna change them into something sensible...

But: I just realized that I have a custom version of ssmtp that was built with SSL support enabled.
The default package that you installed doesn't build with SSL support; I put my package at:
  http://zandbelt.dyndns.org/asterisk/ssm … mipsel.ipk
Try this one (with a corrected config file) and I'll submit the patches to the repository.

Hans.

Yes! Yes! Yes!

It's work with http://zandbelt.dyndns.org/asterisk/ssm … mipsel.ipk

Thank you for your help.

Yann.

How to configure voicemail.conf with ssmtp ?
What's the cmdline ?

Yann

yann78 wrote:

How to configure voicemail.conf with ssmtp ?
What's the cmdline ?

Sigh; you could also actually _try_ some options yourself (e.g. the defaults...) before asking...
Or did you encounter an error? In that case it is useful to report it.

Hans.

To conclude this topic:

I have added a patch (https://dev.openwrt.org/ticket/1578) that adds support for full names to mini_sendmail.
I have also added a patch with SSL support for ssmtp (https://dev.openwrt.org/ticket/1567) that was already included in the source tree.

Now both mini_sendmail and ssmtp work with Asterisk (all versions, with and without full names configured); NB: mini_sendmail does not support secure SMTP (ie. SSL connections).

Thanks to noelb for testing.

Hans

(Last edited by zandbelt on 9 Apr 2007, 17:53)

The discussion might have continued from here.