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!

variable interpolation to sendmail - help please urgent.

Status
Not open for further replies.

Jon99

MIS
Feb 17, 1999
23
0
0
US
I am really struggling with sendmail.
I have an array (@data) that when assigned to $content prints fine and obviously has a string in it. For some reason it does not go through with the sendmail. If I append a string to $content the appended string goes through and appears in the email,, but still not the remainder of the variable. $PARAMS{update} is just a check box that is checked and submitted. $list interpolates fine.

Any ideas pleas?

JOn


for (@data){
push(@body,$$_{1}.'--'.$$_{0}.'\n');
}
$content=join("",@body);
%mail = (
SMTP => 'smtp.wherever.com',
from => 'tclark@whereverl.com',
to => "$list",
subject => 'Firefly updated',
'content-type' => 'text/html; charset="iso-8859-1"',

);
$mail{body} = $content;
if ($PARAMS{update} ne ""){
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";
}
 
I don't know what the function "sendmail()" does,
but I'll bet you are passing uncorrectly the argument %mail.

try: sendmail(\%mail);
otherwise, you will be passing a flat list with
all key-values unrolled.

--
pkiller
 
That is the way it works, from my understanding - mail::sendmail takes in the unrolled hash and processes them accordingly.

Jon
 
hi again,

if the sendmail is indeed being correctly invoked,
then the only visible problem on your script, is
this piece of code (at the start):

for (@data){
push(@body,$$_{1}.'--'.$$_{0}.'\n');
}

the "$$_{1}" seems rather strange to me.
what are you trying to do? on the for loop,
$_ runs through all elements of @data, unless
each of them is a reference, $$_{0} will not
hold anything. perhaps you are missing some
split on $_ before pushing on @body ?

place a 'print $content, "\n";' after '$content=join(...'
to actually see the result of the for loop.


--
pkiller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top