473,412 Members | 2,277 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,412 software developers and data experts.

Problems with headers using mail() function

Oops, I meant to write:
function send_mail($to_name, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());

$headers = "X-Mailer: PHPMailProgram/1.0\n";
$headers .= "From: \"".$from_name."\" <".$from_email.">\n";
$headers .= "Date: $thedate\n";
$headers .= "Content-Type: text/plain\n\n";

$to = "\".$to_name."\" <".$to_email.">";

return mail( $to, $subject, $message, $headers);
}

Sorry 'bout that.

Thank you,
Spartacus
Jun 13 '07 #1
8 1565
Spartacus wrote:
Oops, I meant to write:
function send_mail($to_name, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());

$headers = "X-Mailer: PHPMailProgram/1.0\n";
$headers .= "From: \"".$from_name."\" <".$from_email.">\n";
$headers .= "Date: $thedate\n";
$headers .= "Content-Type: text/plain\n\n";

$to = "\".$to_name."\" <".$to_email.">";

return mail( $to, $subject, $message, $headers);
}

Sorry 'bout that.

Thank you,
Spartacus
First of all, please learn to REPLY to messages instead of starting a
new thread every time.

And why are you putting quotes in the from and to headers?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 13 '07 #2
Spartacus wrote:
Oops, I meant to write:
function send_mail($to_name, $to_email, $from_name, $from_email,
$subject, $message)
{
$thedate = date("r", time());

$headers = "X-Mailer: PHPMailProgram/1.0\n";
$headers .= "From: \"".$from_name."\" <".$from_email.">\n";
$headers .= "Date: $thedate\n";
$headers .= "Content-Type: text/plain\n\n";

$to = "\".$to_name."\" <".$to_email.">";

return mail( $to, $subject, $message, $headers);
}

Sorry 'bout that.

Thank you,
Spartacus
I should also add - the best way to fix these problems is to look at the
headers for a working email, then look at the headers in the email
you're sending. See what is different.

And when I say "look at the headers", I mean examining the source - not
what your reader displays.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 13 '07 #3
Jerry Stuckle wrote:
First of all, please learn to REPLY to messages instead of starting a
new thread every time.
OK, thanks for the tip.
And why are you putting quotes in the from and to headers?
Because they go like this (if you want them to, I believe):

"John Doe" <jo**@doe.com>

That's a legal email address, isn't it?

Spartacus

Jun 13 '07 #4
Jerry Stuckle wrote:
I should also add - the best way to fix these problems is to look at the
headers for a working email, then look at the headers in the email
you're sending. See what is different.
Nothing different, except I don't get what I want - the missing quotes,
names and brackets.
And when I say "look at the headers", I mean examining the source - not
what your reader displays.
I already have. I've echo()'d the headers and examined the source of the
email that turned up.

Spartacus
Jun 13 '07 #5
Spartacus wrote:
Jerry Stuckle wrote:
>I should also add - the best way to fix these problems is to look at
the headers for a working email, then look at the headers in the email
you're sending. See what is different.

Nothing different, except I don't get what I want - the missing quotes,
names and brackets.
>And when I say "look at the headers", I mean examining the source -
not what your reader displays.

I already have. I've echo()'d the headers and examined the source of the
email that turned up.

Spartacus
And when you compare the source of the failing email to the source of a
working email, what do you see?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 13 '07 #6
Jerry Stuckle wrote:
Spartacus wrote:
>Jerry Stuckle wrote:
>>I should also add - the best way to fix these problems is to look at
the headers for a working email, then look at the headers in the
email you're sending. See what is different.

Nothing different, except I don't get what I want - the missing
quotes, names and brackets.
>>And when I say "look at the headers", I mean examining the source -
not what your reader displays.

I already have. I've echo()'d the headers and examined the source of
the email that turned up.

Spartacus

And when you compare the source of the failing email to the source of a
working email, what do you see?
I have to take out the name and the angle brackets. So all I see is an
email address. I can't seem to get the emails to display/send as

Name <email>

--
Spartacus
Jun 13 '07 #7
Spartacus wrote:
Jerry Stuckle wrote:
>Spartacus wrote:
>>Jerry Stuckle wrote:
I should also add - the best way to fix these problems is to look at
the headers for a working email, then look at the headers in the
email you're sending. See what is different.

Nothing different, except I don't get what I want - the missing
quotes, names and brackets.

And when I say "look at the headers", I mean examining the source -
not what your reader displays.

I already have. I've echo()'d the headers and examined the source of
the email that turned up.

Spartacus

And when you compare the source of the failing email to the source of
a working email, what do you see?

I have to take out the name and the angle brackets. So all I see is an
email address. I can't seem to get the emails to display/send as

Name <email>

--
Spartacus
As I said - what do you see when you display the source of the failing
email and compare it to the source of a working email?

It does work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 13 '07 #8
Spartacus <no****@nowhere.comwrote:
>Jerry Stuckle wrote:
>And why are you putting quotes in the from and to headers?

Because they go like this (if you want them to, I believe):

"John Doe" <jo**@doe.com>

That's a legal email address, isn't it?
Yes, for the header lines in the email message, although the quotes aren't
necessary unless the name has certain special characters, so this is ok
too:
John Doe <jo**@doe.com>

However, the addresses that get passed as parameters to the "mail" command
are NOT headers in an email message. They are used in the SMTP dialog with
the mail server. The nickname part is not used there.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 15 '07 #9

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

Similar topics

1
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's...
7
by: news | last post by:
Before I begin, I realise there's a big war regarding HTML in e-mails. Personally, I don't like it. Unfortunately, I'm being paid by my company to create an automated newsletter for our customers....
6
by: Kurda Yon | last post by:
Hi everybody, I have a problem with the function "mail". It returns "true" but supposed recipients receive nothing. My code is as follows: $to = $form; $subject = "E-mail Verification";...
2
by: Spartacus | last post by:
Hello, I know there is lots of information out there and I've taken a look, but I want to learn how to do this myself. And I'm a beginner here and some of it I don't understand (so no flames,...
5
by: Dave | last post by:
Hi All, I'm experiencing problems with sending mail using mail() to forwarded email accounts. The problem seems to revolve around the optional 4th argument of mail(), namely 'additional headers'....
10
by: amygdala | last post by:
Hi all, Another problem that has been bugging me for a while now, but which I swept under the rug too long too now is a mail encoding problem at my (shared) webhost. The problem is that on...
1
by: laredotornado | last post by:
Hi, I cannot seem to send emails. What does it mean when the return value from the "mail" function is an empty string? I'm using php 4.3.11 on a Yahoo! hosting environment. Here is the code:...
3
by: Veli | last post by:
Good Day I have published a website and everything works expect for my forms. I can't seem to send the attachments to the email address according to the uploader. I don't know what i am doing...
2
by: urbanedge | last post by:
I've uploaded a site to a new server and now the headers in the mail function are not working to send the required email response. This is a newly acquired site and my php knowledge is at the...
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.