[ back to toc ]

mailform

Date: 2002/02/04 10:25

Q:
here is an easy question:

in a FormMail Script i have the folowing inputs:
name, email subject and contents

e.g.:

name martin
email mvermaak@hotmail.com

this is what it looks like in my cgi file
note, it's not the complete cgi file, only the imortant parts.

$name = $formdata{'name'}
$email = $formdata{'email'}
$subject = $formdata{'subject'};
$contents = $formdata{'contents'};

$from = $name + "<" + $email + ">"

print MAIL "To: $to \nFrom: $from\n";
print MAIL "Subject: $subject\n";
print MAIL "$contents\n";

The value of $from should be:

martin<mvermaak@hotmail.com>

but it doesn't work.
I know the problem is in the part of

$from = $name + "<" + $email + ">"

but i don't know what it should look like.

please help!

A:
I suppose that the issue is not the format of the From field, but rather
that the SMTP protocol requires the client to log in saying EHLO or HELO
and control information before the body of the mail.

Here I send you a script that sends SMTP mail. You can learn from it, or
just use it.

Regards,
Peter

#!/usr/bin/perl
<cut>
Q:
Hi again,

Thanks for the information so far,

but all i need to know is how to put to textstrings together to fomr one.

e.g.:

$one = "maar"
$two = "ten"

$three = $one + $two

print "$one\n";
print "$two\n";
print "$three\n";

result:*********

maar
ten
*NAME-DELETED*

*************
thanks

Maarten

A:
The string concatenation operator is the dot.

$three = $one . $two

and do not forget the ; from the end of the commands.

Peter

[ back to toc ]