in reply to Re: Setting subject with Net::SMTP
in thread Setting subject with Net::SMTP

I forgot to mention that I am coding this in ActiveState's Win32 implementation ... (i.e. no Mail::Send and no Mail::Mailer) What do you mean by "that's part of the message body you pass whole to it" ? This is what I have so far :
use strict; use Net::SMTP; use FileHandle; my $smtp = Net::SMTP->new('mailhost', Hello => 'exchange.cognos.com', Timeout => 30, Debug => 1, ); my $fh_email_title= new FileHandle; $fh_email_title->open("< email_title.txt") or die "Cannot open email title file: $!"; my $fh_email_content= new FileHandle; $fh_email_content->open("< email_content.txt") or die "Cannot open email content file: $!"; $smtp->mail('travis.weir@cognos.com'); $smtp->to('travis.weir@cognos.com'); $smtp->???($fh_email_title->getlines()); $smtp->data(); $smtp->datasend($fh_email_content->getlines()); $smtp->dataend(); $fh_email_title->close; $fh_email_content->close; $smtp->quit; autoflush STDOUT 1;
Again, I'm not sure what you meant by your earlier statement .... Thanks again, Travis

Replies are listed 'Best First'.
Re^3: Setting subject with Net::SMTP
by Fletch (Bishop) on Jul 26, 2004 at 18:34 UTC

    When you call $smtp->datasend, you're passing the entire message body headers and all. SMTP doesn't have any notion of a messaage subject; the mail and to methods are setting the envelope sender and receiver, but those aren't duplicated inside the body of the message unless you explicitly do so yourself (by calling datasend with "From: ...\n" and the like). If you want to set a subject, just pass datasend a line "Subject: blah\n" somewhere before the body of the message.