473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Blank behind dot disappears with mail()

I have a strange effect:

From a formula I transfer firstname, lastname and email address to a PHP
script. Then mail() shall send this data.

$mailheaders = "From: ".$_POST['firstname']." ".$_POST['lastname'].
"<".$_POST['email'].">\n";
$mailheaders .= "Reply-To: ".$_POST['email'];
mail($_SESSION['recipient'], $_SESSION['subject'], $body, $mailheaders);

Most times this works quite well: A blank is "usually" between first name
and last name. But: If the first name is abbreviated with a point, then the
blank is suppressed in the sent mail.

Correct:
Firstname: Nik
Lastname: Futter
EMail: eMail
changes to: Nik Futter <eMail>

But:
Firstname: N.
Lastname: Futter
EMail: eMail
changes to N.Futter <eMail>

Or (extreme example)
Firstname: F G
Lastname: Xtra Zeta
changes to: F G Xtra Zeta

Firstname: F. G.
Lastname: Xtra. Zeta
changes to: F.G.Xtra.Zeta

For checking I also have attached the variable $mailheaders to the body of
the sent email. At this stage the blank exist behind the dot.

Why this happens ? Is it an error in the script or in mail() ?
Jul 17 '05 #1
2 1979
"Nik Futter" <sp**@unawave.de> wrote in message
news:bt**********@online.de...
I have a strange effect:

From a formula I transfer firstname, lastname and email address to a PHP
script. Then mail() shall send this data.

$mailheaders = "From: ".$_POST['firstname']." ".$_POST['lastname'].
"<".$_POST['email'].">\n";


change to:
$mailheaders = "From: \"{$_POST['firstname']} {$_POST['lastname']}\" " .
"<{$_POST['email']}>\n";

I did two things here, the first, was not a problem, just makes it easier to
read, and that is use {} around the variable inside a quoted string, insead
of string: . variable . string

ok, now the second part, might be your problem, I added \" around the name
the resulting from may need quotes in it, so it looks like this:

from: "john doe" <jd**@mydom.com>

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #2
> ok, now the second part, might be your problem, I added \" around the name
the resulting from may need quotes in it, so it looks like this:

from: "john doe" <jd**@mydom.com>


Thank you very much - this works fine !

Nik
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andy Fish | last post by:
Hi, This has nothing to do with the common "blank line after a form" problem. I have a form with a table with some radio buttons inside it, and I couldn't figure out why it was rendering an...
3
by: Joakim Olesen | last post by:
Hi I have an issue with an asp page that reads from an Excel file. I read the file using OLEDB. I create a new Excel file using "MS Excel 2003" and put the following data into a sheet called...
1
by: Rich | last post by:
I have a simple vb2005 app (for testing). It is just a simple winform with one button that brings up a message box. When I invoke the app and click on the button, the message box comes up OK. ...
1
by: kai | last post by:
Hello, how can I use/save/read values with ";" (start comment) and the value blank? When I write (set) my config file often the part behind the ";" disappears. e.g. myKey = startMyValue ;...
1
by: kai | last post by:
Hello, I use the ConfigPaserver from Python. how can I use/save/read values with ";" (start comment) and the value blank? When I write (set) my config file often the part behind the ";"...
21
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different...
3
by: Wayne | last post by:
I have a report containing 2 subreports. The subreports each contain a chart. The whole thing easily fits on one page but a second blank page is consistently being generated. This has nothing...
2
by: ManningFan | last post by:
I've got a continuous form. The query behind it is updateable, but I don't want the continuous form to display a blank record at the bottom. I've set AllowDeletions to false, AllowAdditions to...
3
Banfa
by: Banfa | last post by:
This page contains a cut down version of this page. They both display the same problem, when the menu at the top is dropped down in IE7 the menu (which is positioned absolutely) disappears...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.