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!
PHP E-Mail Problems
Moderator: General Moderators
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: PHP E-Mail Problems
How did you create your email?
Do it like this:
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);
?>