By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

Problems with mail()

P: n/a
I'm just tinkering with PHP and learning the basics ; all well and good
so far, except I can't get mail() to work.

I'm running Apache 2 & PHP 4.3.9, and ssmtp on Gentoo. ssmtp is set up
correctly (I can use "sendmail" in evolution fine).

When I post from PHP it seems to work ok except it's emailed to
ap****@autismuk.freeserve.co.uk (according to my log). I've tried setting
the sendmail directory option in php.ini to /usr/lib/sendmail & that
doesn't work either..... I'm mystified.

Am I doing something obviously wrong ?
Any ideas ?

<?php

$msg = "Name: $_POST[name]\n";
$msg .= "E-Mail: $_POST[email]\n";
$msg .= "Message: $_POST[message]\n";

$recipient = "au******@autismuk.freeserve.co.uk";
$subject = "Form submission results";
$mailheaders = "From: My Web Site <au******@autismuk.freeserve.co.uk> \n";
$mailheaders = "Reply-To: $_POST[email]";
$mailheaders = ""; // this line in or out makes no odds ....
mail($recipient,$subject,$msg,$mailheaders) or die("Failed to send");

print "Message sent successfully.<br>";

?>
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Paul Robson <au******@autismuk.freeserve.co.uk> wrote in
news:pa****************************@autismuk.frees erve.co.uk:
$recipient = "au******@autismuk.freeserve.co.uk";


try

$recipient = "<au******@autismuk.freeserve.co.uk>";
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.