E-mail received from my form are displaying my host

I have this little piggy setup on my WP 3.1 install, and it’s supposed to be a nice contact form.

The issue is that when I receive the e-mail it shows instead of “myemail@mydomain.com” my webhosts server name.

Read More

Is there ANY way I could correct that?
And there is also a “send a copy to me” function which I would like to use as a BCC just to keep things clean.
THANK YOU IN ADVANCE!

Here is my sendmail.php

require_once("../../../../wp-load.php");

$mail = addslashes($_POST["mailForm"]);
$mail = nl2br($mail);

$from_mail = addslashes($_POST['from_mail']);

$to = wpts_get_option("general", "contact_email");

/* subject */
$subject = "New Contact Message - ATOM";

/* message */
$message = $mail;

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";

/* and now mail it */
if(@mail($to, $subject, $message, $headers))
{
?>
    <div class="success">
    <div class="box-content"><?php _e("Done! We'll contact you in few moments!", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
}
else
{
?>
    <div class="error">
    <div class="box-content"><?php _e("Oh, sorry! Something wrong... Please, try again.", 'atom');?></div>
    <div class="clearboth"></div>
    </div>
<?php
}

?>

And here is my sendorder.php

require_once("../../../../wp-load.php");

$myemail = wpts_get_option("ordernow", "order_email");

$name = addslashes($_POST["name"]);
if($name == '') {
?>
    <div class="error">
    <div class="box-content"><?php _e("Please insert your name.", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
exit;
}

$email = addslashes($_POST["email"]);
if($email == '') {
?>
    <div class="error">
    <div class="box-content"><?php _e("Please insert a email address.", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
exit;
}

$finalOrder = nl2br( addslashes($_POST["finalOrder"]) );

$uploads = addslashes($_POST["uploads"]);

$files = explode(";", $uploads);
$uploads = '';

for($i = 0; $i < count($files); $i++) {
    $uploads .= '- <a href="'.$files[$i].'" target="_blank">'.$files[$i].'</a><br />';
}

$message = str_replace("uploads_here", $uploads, $finalOrder);

/* subject */
$subject = "New Order/Quote Request";

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";

$to = $myemail.','.$email;

/* and now mail it */
if(@mail($to, $subject, $message, $headers))
{
?>
    <div class="success">
    <div class="box-content"><?php _e("Done! You'll receive a order copy in your email.", 'atom'); ?></div>
    <div class="clearboth"></div>
    </div>
<?php
}
else
{
?>
    <div class="error">
    <div class="box-content"><?php _e("Oh, sorry! Something wrong... Please, try again.", 'atom');?></div>
    <div class="clearboth"></div>
    </div>
<?php
}

?>

Related posts

Leave a Reply

1 comment

  1. I was having the same problem. It was showing up from my [login_name]@[mysever].

    Try tweaking your headers.

    I pulled this from http://php.net/manual/en/function.mail.php :

    $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "rn";
    $headers .= 'From: Birthday Reminder <birthday@example.com>' . "rn";
    $headers .= 'Cc: birthdayarchive@example.com' . "rn";
    $headers .= 'Bcc: birthdaycheck@example.com' . "rn";
    

    Hopefully this is what you needed.