Solved

Strange characters in emails sent by PHP

Posted on 2009-06-28
4
352 Views
Last Modified: 2012-05-07

I have using PHP to send an email.  The email is received, but I get what's below; note the 'greater than' symbol before jim's email address. Why is that there?

Dear Dave,

Please let me know as soon as you get back.

>From : jim@whatever.com

$msg .= "\n\nDear Dave\n\nPlease let me know as soon as you get back.\n\nFrom : $sender_email\n\n"; 
$ipaddress = getenv(REMOTE_ADDR);
$msg .= "Logged IP Address:$ipaddress\n\n"; 
 
$recipient = "info@whatever.com"; 
$subject = "Keep me informed"; 
$mailheaders = "From: $sender_email\n\n"; 
 
mail($recipient, $subject, $msg, $mailheaders);

Open in new window

0
Comment
Question by:BlueDriver
4 Comments
 
LVL 9

Assisted Solution

by:pmessana
pmessana earned 20 total points
ID: 24731922
Can you post the entire source of the received email?  Go into the email and 'view source' and paste it here.  Also, are you setting more headers or if you run exactly what you have included it gives this weight greater than?  I am thinking that is something wrong in the header.

I ran the exact code above on my server and it did not return anything out of the ordinary.


~~~~~~~~~
Dear Dave

Please let me know as soon as you get back.

From : peter@xxxxxx.com

Logged IP Address:24.174.xx.xx

~~~~~~~~~~~~
0
 
LVL 14

Assisted Solution

by:profya
profya earned 20 total points
ID: 24731991
We do need to see all code involved in the process, however, there are possible problems from the following:
1) $sender_email is not included in the code submitted.
2) $msg .= "\n\nDear Dave\n\nPlease....." concatenated, I think it should start with:
$msg="........." not $msg.="............"
3) getenv(REMOTE_ADDR); may cause a notice, the best is to write it as
getenv("REMOTE_ADDR");
 I hope this helps
0
 
LVL 19

Expert Comment

by:Michael701
ID: 24732683
try adding some spaces so you don't have blank lines. it may be a response from the smtp server.

$msg .= " \n \nDear Dave\n \nPlease let me know as soon as you get back.\n \nFrom : $sender_email\n \n";
0
 

Accepted Solution

by:
BlueDriver earned 0 total points
ID: 24735197
Dear all,

thank you for your answers. None seemed to fix the issue but eventually I changed the word 'From' to 'sender' and the problem stopped.... It seemed my 'helpful' mail software (TheBat!) automatically added the > symbol to the line, assuming it was a quote.... Arghhh !

Sorry to have troubled you.  Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question