View Full Version : wordpress email sender be overwrited!
It's said that
If the From: header is not formatted correctly, empty or invalid our system will change the from address to be <username>@<host##>.hostmonster.com. To stop this, you must change the script you are using to correctly use a valid From header.
Examples of headers that should work would be:
From: user@domain.com
From: <user@domain.com>
From: "name" <user@domain.com>
Examples of headers that will NOT work:
From: "user@domain.com"
From: user @ domain.com
Then I checked headers before sending mails with mail() function, see below:
From: WordPress <wordpress@guitarbean.com>
Date: Thu, 27 Mar 2008 03:08:30 -0600
Return-Path: wordpress@guitarbean.com
Message-ID: <1d0bbc968e76042a7effb06ce21932ab@guitarbean.com>
X-Priority: 3
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="UTF-8"
But the codes here (http://www.hostmonsterforums.com/showpost.php?p=2428&postcount=2) goes well in hostmonster.
I found the "From:" headers are almost the same but the quots(") of Fromname.
But even if with out quots("), here (http://www.hostmonsterforums.com/showpost.php?p=2428&postcount=2) work well still.:eek:
So, WHAT HAPPEND TO WORDPRESS???????
take a test here http://guitarbean.com/mail.php
pghcollectibles
03-27-2008, 10:40 AM
From: "name" <user@domain.com>
is not the same as
From: WordPress <wordpress@guitarbean.com>
i dont know anything about what your doing but shouldn't there be quotes around "WordPress" ?
From: "name" <user@domain.com>
is not the same as
From: WordPress <wordpress@guitarbean.com>
i dont know anything about what your doing but shouldn't there be quotes around "WordPress" ?
Yes,I have thought about it ,make the From header to From: "WordPress" <wordpress@guitarbean.com>,and tried,but nothing changed. So I remove quotes from THE CODE , but THE CODE runs well. but the Codes in wordpress does't.
pghcollectibles
03-27-2008, 11:27 AM
i tried your http://guitarbean.com/mail.php and i did not enter any info to check if you were using form validation and this appeared above the form upon reentering page after pressing send:
the headers areFrom: "" <> To: "Admin" <> Return-Path: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="9a9a589769a710b432a55ce4f3cefeb5" Message from: E-Mail address: Subject: Message: --9a9a589769a710b432a55ce4f3cefeb5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message from: E-Mail address: Subject: Message: --9a9a589769a710b432a55ce4f3cefeb5 Content-Type: text/HTML; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message from:
E-Mail address:
Subject:
Message: --9a9a589769a710b432a55ce4f3cefeb5-- Could not send contact e-mail. Try again later.
im not sure without seeing your code, but you may not have ended a function correctly or something or why would it show the <> <> and whatnot
enter your email in mailto field,and others, you will get a mail from "sender email",and display as "sender name", and "subject","message" there in the mail.
Sorry, I'm not ready to parse the codes to html code, please view the full codes by right-click, "view page source".
This is an image to show the question.
after the action,happen like this:
the mail.php show you the result,and get an emali in Gmail.
-----------------------------------------------------------------
http://pic.yupoo.com/govo/8747154f45e5/k4x7hcgg.jpg
<?php
$adminmail = $_POST["adminmail"];
if (isset($_POST['send']))
{
// subject
$subject =$_POST['subject']. " - Webpage contact form" ;
// message
$body_html = "Message from: " . $_POST['name']
. "<br /> \nE-Mail address: " . $_POST['mail']
. "<br /> \nSubject: " . $_POST['subject']
. "<br /><br /> \nMessage: \n\n" . $_POST['message'];
$body_plain = $body_simple = strip_tags($body_html);
$boundary = md5(uniqid(time()));
//headers
$headers = 'From: "' . $_POST['name'] . '" <' . $_POST['mail'] . '>' . "\n";
$headers .= 'To: "' . "Admin" . '" <' . $adminmail . '>' . "\n";
$headers .= 'Return-Path: ' . $_POST['mail'] . "\n";
$headers .= 'MIME-Version: 1.0' ."\n";
$headers .= 'Content-Type: multipart/alternative; boundary="' . $boundary . '"' . "\n\n";
$headers .= $body_simple . "\n";
$headers .= '--' . $boundary . "\n";
$headers .= 'Content-Type: text/plain; charset=ISO-8859-1' ."\n";
$headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";
$headers .= $body_plain . "\n";
$headers .= '--' . $boundary . "\n";
$headers .= 'Content-Type: text/HTML; charset=ISO-8859-1' ."\n";
$headers .= 'Content-Transfer-Encoding: 8bit'. "\n\n";
$headers .= $body_html . "\n";
$headers .= '--' . $boundary . "--\n";
// Mail it
echo 'the headers are'.$headers;
if(mail('', $subject, '', $headers)) echo "Thank you for your feedback. If necessary, we will contact you shortly.";
else echo "Could not send contact e-mail. Try again later.";
}
?>
<form method="post" action="mail.php">
sender name:<input name="name" type="text" value="<?php echo $_POST["name"] ;?>"/><br />
sender email:<input name="adminmail" type="text" value="<?php echo $_POST["adminmail"];?>" />
<br />
mailto:<input name="mail" type="text" value="<?php echo $_POST["mail"];?>"/>
<br />
subject:<input name="subject" type="text" value="<?php echo $_POST["subject"];?>"/>
<br />
message:<textarea name="message" type="text" ><?php echo $_POST["message"];?></textarea>
<input type="submit" name="send" value="send" />
</form>
I think this code is OK. But something unusual in wordpress. Do you use wordpress as your blog programme?
RiteshSapra
06-07-2008, 04:36 AM
Hey try this - it'll help you solve your problem.
http://riteshsapra.net/wp/2008/06/05/wordpress-sender-email-incorrect-hostmonster/
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.