Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 07-24-2005, 07:43 AM   #1 (permalink)
konkhra
Registered User
 
Join Date: Jul 2005
Posts: 6
konkhra is on a distinguished road
Unhappy Return Path not shown in mail header

Hy all of you,

Why my Return Path address is not shown in mail's header.Here si my code:

Quote:
<?
$name = stripslashes($_POST['name']);
$from = stripslashes($_POST['from']);
$to = stripslashes($_POST['to']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$xmailer = stripslashes($_POST['xmailer']);
$format = stripslashes($_POST['format']);
$priority = stripslashes($_POST['priority']);
$headers .= "From: \"".$name."\" <".$from.">\r\n";
$headers .= "Return-Path: Name <".$from.">\r\n";
$headers .= "X-Priority: $priority\r\n";
$headers .= "X-Mailer: $xmailer\r\n";
$headers .= "Content-type: text/$format; \r\n";
if($name=="" or $from=="" or $to=="" or $subject==""){
$verify = "<font size=\"4\" color=\"#ff0000\" >Error sending mail.Check all fields and try again.</font>";
}
else {

mail($to,$subject,$message,$headers);
$verify = "Your email has been sent to";
}
?>
On some servers the return path it's shown but on other servers it show me something like this: nobody@whateverdomain.com .it's possible to solve this problem? Thank you.
konkhra is offline   Reply With Quote
Old 07-25-2005, 08:38 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,471
sde is on a distinguished road
are you creating the mail in a loop? i'm just thinking that the $header variable may keep getting appended since you have $headers .= "From... on the first line.

You should probably take out the dot before the equals sign on the FIRST $headers line if you are sending mail in a loop.

Otherwise it seems like it should work if you really have a value in your $name and $from vars.
__________________
Mike
sde is offline   Reply With Quote
Old 07-25-2005, 08:40 AM   #3 (permalink)
konkhra
Registered User
 
Join Date: Jul 2005
Posts: 6
konkhra is on a distinguished road
I solved my problem by adding in mail($to,$subject,$message,$headers); at the end "-f$from".Now it's working perfectly.
konkhra is offline   Reply With Quote
Old 07-25-2005, 08:48 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,471
sde is on a distinguished road
hmm that's a weird fix. that would be the same as moving the top $headers .= line to the bottom I think. maybe the return path is messing it up? not sure.

thanks for posting the fix though.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NEED HELP on card assignment marina Standard C, C++ 9 05-03-2005 07:42 AM
OpenGL.dll Mr.Anderson Platform/API C++ 3 08-13-2004 10:07 AM


All times are GMT -8. The time now is 04:04 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting