Hi John,

did the line end up in the body of the message?  Once you start writing
data, you must write the header lines with no blank lines in between,
because the end of the header and start of the body is signaled by one or
more blank lines. After the blank line, all following lines are part of the
body.

Why do you want to write a line called "Sent" anyway?  If you want to place
the date into an email so that the recipient client displays that date, then
you must include a "Date:" line in the header. There is no "Sent" line
defined in the RFCs (that I can find anywhere) and clients will simply
ignore it. Besides it just being there, it also has to be reasonably close
to the date/time format shown in RFC2822 (how close depends on the client).

Regards,
 Mark

> -----Original Message-----
> From: John Deretich [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 05, 2003 4:56 PM
> To: 'Herbert, Mark'
> Cc: Perl-Win32-Admin-Request (E-mail)
> Subject: RE: :SMTP
> 
> 
> Thanks Mark,
> 
> but one question?
> I tried $smtp->datasend("X-Sent: xxx\n");
> But it didn't put the additional line into
> the header. Any idea why?
> 
> regards,
> 
> John
> 
> -----Original Message-----
> From: Herbert, Mark [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 05, 2003 2:55 AM
> To: 'John Deretich'
> Subject: RE: :SMTP
> 
> 
> Hi John,
> 
> everything entered using datasend is the "body". The protocol 
> has a bunch of
> lines that are placed in a so-colled envelope. The envelope only has a
> from-address (MAIL FROM) and a recipient address (MAIL RCPT). 
> Everything
> else is in the lines of text, which have nothing to do with 
> delivery. The
> Net::SMTP mail() method opens a connection to a SMTP server 
> (by leaving the
> parameters blank, you are trusting that the local Net::SMTP 
> has the defaults
> correctly configured). The to() method sets the envelope 
> to-address, or MAIL
> RCPT. The mail() method sets the from address, or MAIL FROM.  
> The lines of
> text entered using the method datasend, are broken into two 
> parts. The first
> part is the header, and it has nothing to do with the 
> envelope (that's why
> spammers have it so easy). The header is not free text - all 
> header lines
> are defined in varios RFCs. The minimum should include "To:", "From:",
> "Subject:". Most SMTP servers will add missing header lines, such as,
> "Date:", but it is better to specify it yourself. There is no 
> "Sent" header
> line defined in the RFCs, and no such line should be placed 
> in the header.
> If you want to add your own lines to the header, then the 
> lines should begin
> with "X-", such as, "X-Sent:". After the header, comes one or 
> more blank
> lines, followed by whatever lines you want in the message.
> 
> BTW, I have had ActiveState's (Sophos) PureMessage running 
> here for about a
> month now, and improperly configured header lines are good 
> way to get your
> mail blocked by spam filters. You should follow the RFCs very closely.
> 
> I hope that helps.
> 
> Regards,
>  Mark
> 
> > -----Original Message-----
> > From: John Deretich [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 04, 2003 10:12 PM
> > To: 'Herbert, Mark'
> > Subject: RE: :SMTP
> > 
> > 
> > Sorry,
> > 
> > I never received an original answer from you.
> > I think you are right:
> > 
> > This is the exsmple that I am using:
> > 
> > $smtp = Net::SMTP->new('');
> >       $smtp->mail('');  
> >       $smtp->to(""); 
> >       $smtp->data();
> >       $smtp->datasend("To: [EMAIL PROTECTED]");
> >       $smtp->datasend("Subject: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxn");
> >       $smtp->datasend("Sent: xx:xx::xx \n");
> >       $smtp->datasend("\n");
> >       $smtp->datasend("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");
> >       $smtp->datasend("\n");
> >       $smtp->dataend();
> >       $smtp->quit;
> > But it didn't work in the header portion
> > of the email. I think SMTP put it in the body
> > of the message.
> > 
> > thanks,
> > 
> > John
> > 
> > -----Original Message-----
> > From: Herbert, Mark [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 04, 2003 1:04 PM
> > To: 'John Deretich'
> > Subject: FW: :SMTP
> > 
> > 
> > Hi John,
> > 
> > since I thought I answered this, maybe I don't understand 
> what you are
> > asking.
> > 
> > The Net::SMTP module handles the envelope and the data. The 
> > envelope has the
> > MAIL FROM address and the MAIL RCPT address (among a few 
> > other things), but
> > it does not have any date information. A SMTP header 
> can/should have a
> > "Date:" line, but that, and all other header lines, are 
> > written in the data
> > portion of the message. You have to write the data - 
> > Net::SMTP does not do
> > that for you. The data starts with header lines, then a blank 
> > line, then the
> > rest of the message. There is no "Sent" line in the SMTP 
> > standard. I have
> > seen various "X-" lines with their own date/time information, 
> > but the only
> > line defined in the RFCs which has date/time information is 
> > the "Date:"
> > line. Is that what you are trying to add, or something else?
> > 
> > Regards,
> >  Mark
> > 
> > 
> > -----Original Message-----
> > From: Herbert, Mark 
> > Sent: Tuesday, November 25, 2003 10:00 AM
> > To: 'John Deretich'; 'Perl-Win32-Admin-Request'
> > Subject: RE: :SMTP
> > 
> > 
> > Hi John,
> > 
> > you use the mail and recipient methods to define the 
> envelope, but the
> > "To:", "From:", "Date:", "Subject:", etc. lines are included 
> > in the data:
> > 
> > $smtp = Net::SMTP->new($smtpServer);
> > $smtp->mail($mailSender);
> > $smtp->recipient($mailRecipient);
> > 
> > $smtp->data();
> > $smtp->datasend("From: ".$mailSender."\n");
> > $smtp->datasend("To: ".$mailRecipient."\n");
> > $smtp->datasend("Date: ".$datetime."\n");
> > $smtp->datasend("Subject: Text\n");
> > $smtp->datasend("\n");
> > $smtp->datasend($msg."\n");
> > $smtp->dataend();
> > $smtp->quit;
> > 
> > The format of the date/time line is like this: "Fri, 25 Jan 
> > 2002 16:49:57
> > +0100"
> > That is defined in RFC2822.
> > 
> > Regards,
> >  Mark
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: John Deretich [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, November 25, 2003 12:24 AM
> > > To: Perl-Win32-Admin-Request (E-mail)
> > > Subject: Net::SMTP
> > > 
> > > 
> > > Hello,
> > > 
> > > does anyone know how to put
> > > in the date and time in the "sent:"
> > > section of the email using Net::SMTP?
> > > 
> > > 
> > > thanks,
> > > 
> > > John
> > > _______________________________________________
> > > Perl-Win32-Admin mailing list
> > > [EMAIL PROTECTED]
> > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> > > 
> > 
> 
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to