Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  Problem with smtp_client-1.1

axel
Posted: Tue Jul 04, 2006 8:22 am Reply with quote
User Joined: 03 Mar 2005 Posts: 271
On 2006-07-01 05:17, Roberto Saccon wrote:
> I try to use smtp_client (inside yaws, but also standalone) to send
> e-mails, but I get an error when the SMTP-FiniteStateMachine starts to
> send the message:
>
> mfrom_error "501 Bad address syntax\r\n"
>
> the from-address in this case is: rsaccon@freesurf.ch , and I don't

sorry, but i have been unable to reproduce this error.
moreover, from reading the code
(yaws-1.63/applications/mail/src/smtp.erl) i can not find how that error
could happen.


bengt
--
EPO guidelines 1978: "If the contribution to the known art resides
solely in a computer program then the subject matter is not
patentable in whatever manner it may be presented in the claims."
Post generated from www.trapexit.org
View user's profile Send private message
Guest
Posted: Tue Jul 04, 2006 11:14 am Reply with quote
Guest
Bengt Kleberg <bengt.kleberg@ericsson.com> wrote:
>
>On 2006-07-01 05:17, Roberto Saccon wrote:
>> I try to use smtp_client (inside yaws, but also standalone) to send
>> e-mails, but I get an error when the SMTP-FiniteStateMachine starts to
>> send the message:
>>
>> mfrom_error "501 Bad address syntax\r\n"
>>
>> the from-address in this case is: rsaccon@freesurf.ch , and I don't
>
>sorry, but i have been unable to reproduce this error.
>moreover, from reading the code
>(yaws-1.63/applications/mail/src/smtp.erl) i can not find how that error
>could happen.

Presumably the error comes from the SMTP server - e.g. the SMTP protocol
spec requires that the addresses given as arguments to "MAIL From:" and
"RCPT To:" are enclosed in < > brackets. Many/most MTAs aren't picky
about that, but some may be - in particular these days some people find
that strict enforcement of standards may block messages from badly
written spamware with little or no "collateral damage". It might be a
good idea to have smtp.erl add the brackets (if they aren't there
already) - or make sure that it always talks to a local SMTP server that
still follows the old "be liberal in what you accept" adage.

--Per Hedeland
Post generated from www.trapexit.org
axel
Posted: Tue Jul 04, 2006 12:07 pm Reply with quote
User Joined: 03 Mar 2005 Posts: 271
On 2006-07-04 13:07, Per Hedeland wrote:
...deleted
> Presumably the error comes from the SMTP server - e.g. the SMTP protocol
> spec requires that the addresses given as arguments to "MAIL From:" and
> "RCPT To:" are enclosed in < > brackets. Many/most MTAs aren't picky

you are correct about < > brackets. the lack thereof could cause the
server to refuse to send an email. i just have a problem locating where
in the erlang code the error from the SMTP server will end up as a
thrown error.
perhaps the error is in another smtp module, than the one i am looking at?


bengt
--
EPO guidelines 1978: "If the contribution to the known art resides
solely in a computer program then the subject matter is not
patentable in whatever manner it may be presented in the claims."
Post generated from www.trapexit.org
View user's profile Send private message
Guest
Posted: Tue Jul 04, 2006 3:24 pm Reply with quote
Guest
Per and Bengt, thanks very much, after adding the brackets to the
address, it works like charm !

On 7/4/06, Bengt Kleberg <bengt.kleberg@ericsson.com> wrote:
> On 2006-07-04 13:07, Per Hedeland wrote:
> ...deleted
> > Presumably the error comes from the SMTP server - e.g. the SMTP protocol
> > spec requires that the addresses given as arguments to "MAIL From:" and
> > "RCPT To:" are enclosed in < > brackets. Many/most MTAs aren't picky
>
> you are correct about < > brackets. the lack thereof could cause the
> server to refuse to send an email. i just have a problem locating where
> in the erlang code the error from the SMTP server will end up as a
> thrown error.
> perhaps the error is in another smtp module, than the one i am looking at?
>
>
> bengt
> --
> EPO guidelines 1978: "If the contribution to the known art resides
> solely in a computer program then the subject matter is not
> patentable in whatever manner it may be presented in the claims."
>


--
Roberto Saccon
Post generated from www.trapexit.org
Guest
Posted: Wed Jul 05, 2006 4:32 am Reply with quote
Guest
Hi all,
After sending email , I used smtp_fsm:close(Pid) in my erlang appplication.
Then following error occured.So therefore my application crashed.So how to
avoid or handle that error to stop crashing??
Regards,
Shehan


=ERROR REPORT==== 5-Jul-2006::09:41:16 ===
** State machine <0.22477.0> terminating
** Last event in was close (for all states)
** When State == smtp_conn
** Data == []
** Reason for termination =
** i_have_quit

=CRASH REPORT==== 5-Jul-2006::09:41:16 ===
crasher:
pid: <0.22477.0>
registered_name: []
error_info: i_have_quit
initial_call: {gen,init_it,
[gen_fsm,
<0.22476.0>,
self,
omniesme_fsm,
["192.168.4.21",25],
[]]}
ancestors: [<0.22476.0>]
messages: []
links: [#Port<0.383>]
dictionary: []
trap_exit: false
status: running
heap_size: 610
stack_size: 21
reductions: 889
neighbours:


Post generated from www.trapexit.org
axel
Posted: Wed Jul 05, 2006 6:35 am Reply with quote
User Joined: 03 Mar 2005 Posts: 271
On 2006-07-05 06:20, shehan wrote:
> Hi all,
> After sending email , I used smtp_fsm:close(Pid) in my erlang appplication.
> Then following error occured.

According to the example in smtp_fsm.erl this is not an error, but the
expected behaviour/result of smtp_fsm:close(Pid).


> So therefore my application crashed.So how to
> avoid or handle that error to stop crashing??

smtp_fsm:handle_event(close, ...) returns i_have_quit as the Reason (in
{stop,Reason,NewStateData}) and according to the gen_fsm manual :

''Note that for any other reason than normal or shutdown, the gen_fsm is
assumed to terminate due to an error''

so you can change i_have_quit to normal or shutdown to avoid the crash.


fyi: unless you need some of the features only available in
smtp_client-1.1 there is another smtp client (distributed with yaws)
that does not have this problem.


bengt
--
EPO guidelines 1978: "If the contribution to the known art resides
solely in a computer program then the subject matter is not
patentable in whatever manner it may be presented in the claims."
Post generated from www.trapexit.org
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum