PHP123
asked on
Sending Email in PHP
Hi,
I am using the following PHP code to send an email
$to = 'me@hotmail.com';
$from = 'you@yahoo.com';
$subject = "Subject";
$mailbody = "Content"
$mailforms = mail($to, $subject, $mailbody, $from);
Problem is , when i receive an email it has the "From address" set to "Apache" my sever default instead of "you@yahoo.com".How can i resolve this problem?
Thanks in Advance.
I am using the following PHP code to send an email
$to = 'me@hotmail.com';
$from = 'you@yahoo.com';
$subject = "Subject";
$mailbody = "Content"
$mailforms = mail($to, $subject, $mailbody, $from);
Problem is , when i receive an email it has the "From address" set to "Apache" my sever default instead of "you@yahoo.com".How can i resolve this problem?
Thanks in Advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The problem, that other people on the page tryied to explain is, that the $from parameter of the mail command is not the value of the 'From:' field in the mail header , but it modifies the mailheader lines according to the 'Value_name:' contained in the $from variable - referr to the RFC 2822 (rfc-editor.org) for more information for mail headers.
mail(to, subject, body, "From : from address");
the style is like this, I don't know weather writing "from : " or "From:" is correct or not, but this format works ;)
the style is like this, I don't know weather writing "from : " or "From:" is correct or not, but this format works ;)
$to = 'me@hotmail.com';
$from = 'you@yahoo.com';
$subject = "Subject";
$mailbody = "Content"
$mailforms = mail($to, $subject, $mailbody, "From: ".$from."\nReturn-path: <".$from.">\n");
$from can also be given from a html/php form page filled by the visitor.
j79
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&
mail($receiver,$subject,$m
where:
$sender would be smthg like you@yourdomain.tld
$mailclient - normally used to pass on that it was mailed from within a php script, but you can set anything here like "my cool mail tool"
$prior_1 would be 1, 2 or 3 with 1 being normal, 2 being medium and 3 being high
$prior_2 is only for microsoft - just have to write normal, medium or high there...
think that should do it
regards liquidblaze