php with fasthosts.
So i was doing a php email form the other day for ilikehammocks.
I was sure i wrote the code right but it wouldn’t work. For the life of me i couldn’t figure out why.
Enter google.
I went wandering round google until i was lost in the realms of uber geeks. It turns out that fasthosts (my domain provider) forgot about the email function in php, and to get around it i had to add this to the first line of my code:
ini_set("sendmail_from", " email@somedomain.com");
score!
For some reason fasthosts like to dismiss the simple things, so if you’re having a problem with getting emails to actually go anywhere, like i was, this seems to be the way to fix it. All the rest of my code could then stay the same but it then knew what it was doing in terms of carrying out the send function.
I dont think any more explanation is necessary, but get in touch if you need more help.
Im having loads of probs with Fasthosts and php mail()
$nl = ‘\n’;
$name_field = $_POST['Name'];
$email_field = $_POST['Email'];
$message = $_POST['Message'];
$headers = ‘From: $email_field’ . $nl;
$headers .=’Reply-To: $email_field’ . $nl;
$headers .=’Return-Path: $email_field’ . $nl;
$headers .=’X-Mailer: PHP/’ . phpversion();
$f = $to;
$msg = wordwrap($message,70);
ini_set(”sendmail_from”, ” “.$to);
mail($to, $subject, $msg, $headers, “-f”.$f);
any help would be great !!
Pete | April 2nd, 2008 | 9:49 pm
Excellent, thanks for sharing that! With a bit more of a search I found the Fasthosts knowledge base on it (linked below.) I think it’s also worth mentioning that the “somedomain” is the domain for the website from which email is to be sent.
http://www.fasthosts.co.uk/knowledge-base/?article_id=70
Chris | April 22nd, 2008 | 5:35 pm
Fantastic! Thanks for this super useful posting … my feedback form is sorted now! BIG thanks!
Rudina | May 16th, 2008 | 7:37 am
Never be tempted to use Fasthosts.
They are rubbish in everything they do.
Whether it is just for one basic site, or like us a reseller with many, do not go near them.
They will be more trouble than they are worth, with slow servers, bad idiotic support and terrible attitude to customer retention. Don’t do it
Mark | June 25th, 2008 | 5:50 pm
Mark before I would have agreed with you but they have improved greatly over the last 12 months, I have been with them 7 years, they offer affordable hosting and the reseller package offers good value and 24/7 support.
Unless you have a big budget and can go to rack space I cant think of anyone better.
Who do you use?
Dave | June 25th, 2008 | 9:15 pm