Hi,
It seems that no matter what PHP script I use to send an email it won't work, is this something to do with the server?
The most basic code I have tried is the following:
Can anyone see why this might not work?
Thanks,
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("Message successfully sent!");
} else {
echo("Message delivery failed...");
}





teammatt3 posted this at 18:23—10th April 2008.
He has: 1,809 posts
Joined: Sep 2003
Which message are you getting? If you get the successful message, your server might be blacklisted by the recipient. If you get the failed message, your server probably isn't setup right, and you should talk with your host about it.
My Site | Regular Expression Tester
drew22299 posted this at 21:45—10th April 2008.
He has: 107 posts
Joined: Mar 2006
I don't get any message lol I think my host provides smtp settings but not sure how to set them up or whether they need to be setup? Thanks, I will ask the hosting company about it.
www.hotlista.co.uk
pr0gr4mm3r posted this at 18:07—22nd April 2008.
He has: 470 posts
Joined: Sep 2006
I use htmlMimeMail to send all my email from PHP. It allows you to use remote (or local) smtp servers which will bypass any host restriction on the local mail() function. This class also supports mail in HTML and text format as well as attachments.
teammatt3 posted this at 22:05—22nd April 2008.
He has: 1,809 posts
Joined: Sep 2003
That's a neat little class. I've tried a bunch like it and they all fail when I try to use gmail as the SMTP server. This one worked the first time I tried it. Sweet
My Site | Regular Expression Tester
greg posted this at 22:14—22nd April 2008.
He has: 336 posts
Joined: Nov 2005
Your code looks fine, so it might be something to do with your host and the server outgoing smtp config.
And of course I presume you have double checked your email address in $to
www.imagehost-4u.com