Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subject in mail

Status
Not open for further replies.

kisan

Programmer
Nov 14, 2002
7
0
0
GB
Hi,

Could anyone help me, how to can I set the subject of a mail, if I want to use the SMTP modul?
$smtp = Net::SMTP->new('1.2.3..4', Debug => 0);
$smtp->mail("as@df.gh");
$smtp->to('qw@er.tz');
$smtp->data();
$smtp->datasend("fgv");
$smtp->dataend();
$smtp->quit;

#There is a way, to write the subject in the mail, but it will be in the body of the #e-mail, and not in the header:
# $smtp->datasend("Subject: MySubject");


kisan
 
Did you put in all your Header info?

[tt]
use Net::SMTP;


$smtp->datasend("From: $Fromaddresshere\n");
$smtp->datasend("To: $Toaddresshere\n");
$smtp->datasend("Subject: MySubject\n");
$smtp->datasend("\n");[/tt]

=================
Bad Company Music
=================
 
Yes I have tried it as well.
Unfortunately it puts the following lines into the body of the mail:

To: me

Subject: MySubject
BlahBlah

..and the Subject field has already been empty.

kisan
 
Try smtp in a hash:

[tt]
{
my %mail = ( To => 'to_email_address',
From => 'from_email_address',
Subject => "Bad Company with Paul Rodgers",
Message => "Message you want in your email message",
);
$mail{smtp} = '111.222.3.44'; #your smtp ip address

sendmail(%mail) || die "\nProblem! $Mail::Sendmail::error\n";[/tt]
} =================
Bad Company Music
=================
 
$smtp->data();

Put that line directly below the following line:

$smtp->mail("as@df.gh");

That order works for me with my similar scripts, header and message end up in the right places.

and then:

$smtp->dataend();

at the end of the mail script. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top