Page 1 of 1

Mail() problems

Posted: Sun Jun 09, 2002 11:03 am
by f1nutter
Folks,

I am setting up a form to add links to my web-site. When the user has submitted their details I want to send an automatic e-mail, thanking them, or something.

This is what I have so far, and it works hunky-dory.

Code: Select all

<?php
$contact = "f1nutter2000@yahoo.co.uk";
$to = "<$contact>";
$subject = "Thank-you";
$message = "Thanks for adding your link";
$from = "From: Links <links@f1nutter.com>";

mail($to, $subject, $message, $from);
?>
I can't sent e-mails more than one at a time ($to = "<$contact1>, <$contact2>") as I would like to send myself one when the link is added, and also for future applications. Although not important, why does the friendly "to" name not work.

My php.ini settings are:

STMP= mail.btinternet.com
sendmail_from=

I am using PHP 4.2.0 with Win98 and PWS 4.0

Thanks.

Posted: Sun Jun 09, 2002 11:36 am
by fatal
$to = "<$contact>";
Change that to: $to = "$contact";

Posted: Sun Jun 09, 2002 2:45 pm
by sam
To expand on what fatal said. You do not need to include the <>'s in the address when sending mail from php. It is only used to attach an email to a know name in e-mail client programs... If you are going to use it, add a username in front to it and inclose the whole thing with "s...

Code: Select all

$to = ""Sam McKone <sam@evilwalrus.com>"";
Cheers Sam

Posted: Sun Jun 09, 2002 3:03 pm
by f1nutter
Thanks Sam and Fatal,

Thats cleared up a lot. The PHP manual still needs a little working on!

F1 Nutter.