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!

E Mail in script

Status
Not open for further replies.

repairer

Vendor
Jan 10, 2002
21
0
0
Could anyone help me with following problem, I downloaded a message board script from
I have got the scrip working and can post mesages, what I cannot get it to do is mail a new user back with his activation code. I have no knowledge whatsoever of pearl, but from what I read on the support forum there, the script is setup for a NT server and needs changing if run on a Unix server (as mine is) it would appear that many of the users had the same problem. One user posted a solution -


it says to copy this text into the body of the cgi script, this I did and carried out a few test mails, at first I was getting mails returned with following error

johnsmith\@hotmail.com it should not have had the \ in the address, it was returning the mail to my webmaster address, after a bit "messing about" changing bits in the script I finally got it where the mail address was OK but still got the mail returned with the following error -

A message that you sent contained one or more recipient addresses that were
incorrectly constructed

The mail address in the returned mail looks OK, its even highlighted blue as a mail link, there does not appear to be any problem with it, can anyone help me?

Many thanks

Pete
 
It depends how the mail program is set up to work.
The '\' is to tell Perl to ignore the '@' symbol. It would appear that the address string is being used literally.

For the forum to help you further, you would have to at least supply some non working code for us to work with.


Keith
 
Keith,

I'm not too sure what part of the script you would want ot see, what I did was enter the following at the begining of the script -

$mailprog = '/usr/sbin/sendmail -i -t'; # for send mail

and then I included these lines under the "sub SendMail"

my ($from, $to, $subject, $content) = @_;
($eusr, $edom) = split /\@/, $to;
$to = "$eusr\@$edom";
open(MAIL,"|$mailprog");
print MAIL "To: $to ";
print MAIL "From: $from ";
print MAIL "Subject: $subject ";
print MAIL $content;
print MAIL " ";
close (MAIL);

Does the above help you?


Thanks


Pete
 
print MAIL "Subject: $subject \n";

Add this newline char before your content.
 
actually, I'll change that to adding the '\n' to every line, and a double '\n\n' before content.
 
Thanks guys for your help, managed to get it working, what I did was the orginal script had -

$to = "$eusr\\\@$edom";

I took out two of the \ and got it to work, not sure why but it does.


Thanks for your help.


Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top