Mail to issue
Moderator: General Moderators
-
nathanbrooks
- Forum Newbie
- Posts: 8
- Joined: Tue Aug 18, 2009 10:59 am
Mail to issue
Hi there,
I used a php function 'mail' to send an email to the sender saying 'thanks for the enquiry' etc etc.
My problem is that once you receive the email, under the 'sent by' tab it doesnt show the senders address but instead shows a random address, such as 'www-data'.
What do I do to correct this issue?
I used a php function 'mail' to send an email to the sender saying 'thanks for the enquiry' etc etc.
My problem is that once you receive the email, under the 'sent by' tab it doesnt show the senders address but instead shows a random address, such as 'www-data'.
What do I do to correct this issue?
Re: Mail to issue
Are you putting "From: your email address" in the headers?
And yeah, ditto. Post code.
And yeah, ditto. Post code.
-
nathanbrooks
- Forum Newbie
- Posts: 8
- Joined: Tue Aug 18, 2009 10:59 am
Re: Mail to issue
Sure here it is :
if (!empty ($_POST ['email']))
{
$sender=$_POST ['email'];
}
$info = array ($name, $surname, $mobile, $sender, $query);
$message="";
for ($i=0; $i < count($info); $i++)
{
$info [$i]=ucfirst ($info [$i]);
$message.=$info[$i]."\n";
}
mail("nathan@redzebramobile.co.za", $message, $sender);
HTML :
<tr>
<td width="100px">
Email :
</td>
<td >
<input name="email" type="text" class="searchBox">
</td>
</tr>
if (!empty ($_POST ['email']))
{
$sender=$_POST ['email'];
}
$info = array ($name, $surname, $mobile, $sender, $query);
$message="";
for ($i=0; $i < count($info); $i++)
{
$info [$i]=ucfirst ($info [$i]);
$message.=$info[$i]."\n";
}
mail("nathan@redzebramobile.co.za", $message, $sender);
HTML :
<tr>
<td width="100px">
Email :
</td>
<td >
<input name="email" type="text" class="searchBox">
</td>
</tr>
Re: Mail to issue
Yeah, as I said, you're not putting a "From" header...so it'll send from the default email address in php.ini instead.
-
nathanbrooks
- Forum Newbie
- Posts: 8
- Joined: Tue Aug 18, 2009 10:59 am
Re: Mail to issue
Thank you very much.
Can you give me an example?
Can you give me an example?
Re: Mail to issue
http://uk.php.net/manual/en/function.mail.php
Check out the examples and comments. You'll see they're putting "From: emailaddy" as the fourth arg.
Check out the examples and comments. You'll see they're putting "From: emailaddy" as the fourth arg.
- arminium
- Forum Newbie
- Posts: 18
- Joined: Wed Aug 12, 2009 10:02 pm
- Location: Sunshine Coast, AUSTRALIA!!!!!!
Re: Mail to issue
Code: Select all
<?php
$to = 'tommy@gizoo.com';
$subject = 'Example Subject';
// message
$message = '
<html>
<head>
<title>Example</title>
</head>
<body>
<p>Some text</p>
</body>
</html>
';
// sending HTML mail set the Content-type
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Wally <wally@one.com>, fred <fred@fred.com>' . "\r\n";
$headers .= 'From: Me <no-reply@tech.com>' . "\r\n";
$headers .= 'Cc: friends@tech.com' . "\r\n";
$headers .= 'Bcc: foes@tech.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
- arminium
- Forum Newbie
- Posts: 18
- Joined: Wed Aug 12, 2009 10:02 pm
- Location: Sunshine Coast, AUSTRALIA!!!!!!
Re: Mail to issue
or for your example just change
mail("nathan@redzebramobile.co.za", $message, $sender);
to
mail("nathan@redzebramobile.co.za", $message, "From: ".$sender);
should work ok
mail("nathan@redzebramobile.co.za", $message, $sender);
to
mail("nathan@redzebramobile.co.za", $message, "From: ".$sender);
should work ok
-
nathanbrooks
- Forum Newbie
- Posts: 8
- Joined: Tue Aug 18, 2009 10:59 am
Re: Mail to issue
Thank you very very much 
Going to try it as soon as I can.
Going to try it as soon as I can.
- lord_webby
- Forum Commoner
- Posts: 44
- Joined: Wed Aug 19, 2009 9:01 am
Re: Mail to issue
Have you tried setting the sendmail_from in php.ini?