PHP mail not working


#1

Hi all,

I have spent many a hour trying to figure out what I am doing wrong here, for some reason my “mail” function is not working on my account… I think…?

Below is the code I am using to send mail from my website (without some of the gumf)…

$to = "james@blarblarblar.co.uk";
$subject = “Some kind of subject”;
$message = “New email from someone\n”;
$message .= “I would like more information on: …”;
$headers = “MIME-Version: 1.0\n”;
$headers .= “Content-type: text/plain; charset=iso-8859-1\n\t”;
$headers .= “Content-Transfer-Encoding: 8bit\n\t”;
$headers .= “From: My Site my@site.com\n\t”;
$headers .= “X-Priority: 1\n\t”;
$headers .= “X-MSMail-Priority: High\n\t”;
$headers .= “X-Mailer: PHP/” . phpversion()."\n\t";

mail($to, $subject, $message, $headers);

Can anyone see any problems with this? It looks ok to me but would like a second opinion if possible.

If it looks ok, any ideas why it is not working?

Many thanks,
James


#2

Are you using DH email server or Google email server?

If email server is not set up for your account, you can try to send email via SMTP. SMTP email functions is able to send emails using a valid SMTP email server regardless where the SMTP email server is. If you search google about PHP SMTP Mail Class, you will find a lot of results.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#3

Hi,

No I am not using any Google for my email.
I am using PHP version 5.2.x, I tried changing to mod version 4.4.x and still not working. I also removed extra web security. But no good :frowning:
Any other ideas before I bother support?

Many thanks,
James


#4

Well I had to contact support.

They said:
“That code appears to be correct. It looks like procmail was not setup correctly on your server. Procmail is the service which sends mail from your server. It was missing some components and that was causing the mail to simply queue on the server. I fixed procmail and it is now sending out the queued emails.”

I dont care if people like DH or not, the guys working for DH certainly know their stuff when it comes to support.

Thanks guys :slight_smile:

eot


#5

Why are you ending the header lines with tabs? The header lines should end with \r\n.


:stuck_out_tongue: Maximum savings promo code: MaxSavingsAtDH


#6

Yep your right… my bad