473,796 Members | 2,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with headers using mail() function

Oops, I meant to write:
function send_mail($to_n ame, $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 1594
Spartacus wrote:
Oops, I meant to write:
function send_mail($to_n ame, $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*******@attgl obal.net
=============== ===
Jun 13 '07 #2
Spartacus wrote:
Oops, I meant to write:
function send_mail($to_n ame, $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*******@attgl obal.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*******@attgl obal.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*******@attgl obal.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
2894
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 webmail. And I know they work on *my* Outlook Express. But I have one person (I know of) who gets the emails as plain text, so she sees the HTML code for the email instead of its proper representation. She has, like myself, OE6, and other html emails...
7
2214
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. I did all I could just to get them to allow me to have it sent in both plaintext and HTML so that the e-mail clients have a choice. Anyway. I've looked around the RFC's and the source of similar e-mails, and I'm certain I figured out how to do...
6
1723
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"; $body = 'The first line\n'; $body .= 'The second line.'; $headers = 'From: webmaster@example.com';
2
1675
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, RTFM or GFGI please ;) Here's my function: function send_mail($to_name, $to_email, $from_name, $from_email, $subject, $message)
5
3949
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'. It seems that when I populate this 4th argument of mail(), any emails sent to an email forwarding service email address (ukreg/fasthosts actually) fail to reach their destination. Direct email addresses seem to work fine.
10
3336
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 different occassions when I send the exact same mail (same e-mail address, same name, same body content) through my site's contactform it produces the wellknown strange characters instead of the intended diacritical characters. This problem also...
1
1497
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: $p_from = "dalvarado@mydomain.com"; $headers = "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=iso-8859-1\n"
3
1614
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 wrong please help ....................i really need serious help the field picture2, picture4 and video are uploaders <?php $firstname = $_POST; $lastname = $_POST; $email = $_POST; $number = $_POST; $NameOfAdvertisedItem = $_POST;
2
1854
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 beginner level. I've managed to list the headers that are being sent but I can't seem to find where or why the email won't work. I'd really appreciate some help checking to see if there is an error in one of the header lines or perhaps the redirection. ...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10242
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.