PHP E-Mail Problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CoryT
Forum Newbie
Posts: 1
Joined: Mon Nov 01, 2010 11:11 am

PHP E-Mail Problems

Post by CoryT »

I am trying to create an email to send to users who sign up on our website. However, the email server seems to be ignoring my 'from' setting, as the email is always from what appears to be the main server URL and not the email address I have specified. I have wracked my brain and cannot find what the problem is. Anyone have any suggestions as to what might be causing this issue?

Many thanks in advance!
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: PHP E-Mail Problems

Post by klevis miho »

How did you create your email?
Do it like this:

Code: Select all

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
Post Reply