[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] SMTP emailing works fine!




[In a message on Tue, 24 Aug 1999 09:02:48 +1000,
	"Charles Cave" wrote:]
>I also learnt that extra header lines need to be included
>in the message such as To: and From:  These are included
>in the $subject variable.  An email message has a header
>followed by two \n characters then the body of the message.
>...
>$subject = "From: Charles Cave <charles\@mpx.com.au>\nSubject: My test
>message\n\n";
>...
>Here is the message I got. Note that a To: line is
>missing, and this could be included in the $subject string.
>
>
>>X-From_: mpx.com.au!charles Mon Aug 23 22:42:04 1999
>>Date: Mon, 23 Aug 1999 22:42:03 +1000
>>Apparently-To: <charles@mpx.com.au>
>>From: Charles Cave <charles@mpx.com.au>
>>Subject: My test message
>>
>>MacPerl sent this message. Nifty eh??
>>Please confirm receipt to charles@mpx.com.au
>>Many thanks!!!


You didn't get a "to:" lin in the mail because you didn't put one in
the data.  SMTP uses an envelope/letter metaphor, just like sendmail
on UNIX.  The RCPT To: and MAIL From: (which is what the $smtp->to and
$smtp->mail methods are doing) are envelope addresses.  The data
consists of mail headers and the body of the message.  The headers are
what are usually shown in mail programs, but typically match the
envelope addresses.  This isn't always the case, such as in BCC
e-mail.

In anycase, I agree with Mr. Kimball that you should rename $subject
to $header.  You should also probably make it a little easier to read
by doing something like:

$header = "From: blahblahblah\n";
$header .= "To: blahblahblahgingerblah";
$header .= "Subject: good dog!\n";
...

The RFC's are very helpful in understanding SMTP and internet mail.

Sean (still lurking after only two days on the list) Kamath


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org