Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Termination String in Net::SMTP

by skazat (Chaplain)
on May 07, 2007 at 20:56 UTC ( [id://614036]=perlquestion: print w/replies, xml ) Need Help??

skazat has asked for the wisdom of the Perl Monks concerning the following question:

In Net::SMTP, there's a method called, data(), which you can call to send the actual email message you went send out, out.

According to the Net::SMTP docs, it will automatically plop the termination string:

data ( DATA )

Initiate the sending of the data from the current message.

DATA may be a reference to a list or a list. If specified the contents of DATA and a termination string ".\r\n" is sent to the server. And the result will be true if the data was accepted.

If DATA is not specified then the result will indicate that the server wishes the data to be sent. The data must then be sent using the datasend and dataend methods described in Net::Cmd.

Question is - does the data() method also automatically parse out the termination string from the string you pass it?

I'm discovering email messages that are cut short and - wouldn't you know it, they're being cut exactly where there's a dot, following two lines (haven't seen which type of carriage return-type-thing)

If it's supposed to and it's not - is this a bug? (ie: *should* it?)

If it's not supposed to, shall I annotate the the module? and say it's your responsibility?

 

-justin simoni
skazat me

Replies are listed 'Best First'.
Re: Termination String in Net::SMTP
by Krambambuli (Curate) on May 07, 2007 at 22:18 UTC
    Take care when using Net::SMTP - it is meant to implement SMTP, and the protocol (as described in RFC2821) specifically refers to how a dot (period) as first char of a line is a special beast. That beginning dot must be doubled by the client - and the server will take the opposite action, getting rid of one of the two.

    That's because a single dot on a line is actually the way the client annnounces the server that the data stream is finished.

    And Net::SMTP doesn't check the data you send - so take care, if you have a single dot as first char somewhere within data, that will determine the SMTP server to close the connection.
Re: Termination String in Net::SMTP
by kyle (Abbot) on May 07, 2007 at 21:17 UTC

    I had a look a the Net::SMTP source, and it would appear that it does not parse out the termination string from whatever you pass in. I mean, it doesn't look as if that's something it's even trying to do.

    If it's supposed to and it's not - is this a bug? (ie: *should* it?)

    If I were using it, I think it'd be nice if it did do that, but I'm not sure I'd call it a bug. Either way, I think its actual behavior should be documented.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://614036]
Approved by kyle
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-03-19 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found