By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,016 Members | 2,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,016 IT Pros & Developers. It's quick & easy.

Problems with the function "mail" of PHP.

P: n/a
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[address1];
$subject = "E-mail Verification";
$body = 'The first line\n';
$body .= 'The second line.';
$headers = 'From: we*******@example.com';
$res = mail($to, $subject, $body, $headers);

I tried to send messages to two different e-mail addresses (to my yahoo
account and on my university one). No one mail-box got the message. I
also checked the bulk folder of the yahoo mail, it is also empty. Gould
you please help me to solve this problem?

Nov 26 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Kurda Yon" <ku******@yahoo.comwrote in news:1164554494.863051.105600
@f16g2000cwb.googlegroups.com:
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[address1];
$subject = "E-mail Verification";
$body = 'The first line\n';
$body .= 'The second line.';
$headers = 'From: we*******@example.com';
$res = mail($to, $subject, $body, $headers);

I tried to send messages to two different e-mail addresses (to my yahoo
account and on my university one). No one mail-box got the message. I
also checked the bulk folder of the yahoo mail, it is also empty. Gould
you please help me to solve this problem?
start debugging, at the very least find out what is returned by $res

Nov 26 '06 #2

P: n/a
start debugging, at the very least find out what is returned by $res
The main problem is that I do not know from what should I start the
debugging. I have no output to analyses. This function is like a
"black box". I red the description of this function and tried to
full fill all requirement of the correct usage. But id does not work.

Nov 26 '06 #3

P: n/a
"Kurda Yon" <ku******@yahoo.comwrote in news:1164577558.670931.298410@
45g2000cws.googlegroups.com:
>start debugging, at the very least find out what is returned by $res
The main problem is that I do not know from what should I start the
debugging. I have no output to analyses. This function is like a
"black box". I red the description of this function and tried to
full fill all requirement of the correct usage. But id does not work.
try using this class, it's great, and i presume it will do some debugging
output in case it fails for you:

http://phpmailer.sourceforge.net/
Nov 26 '06 #4

P: n/a
>I have a problem with the function "mail". It returns "true"
>but supposed recipients receive nothing. My code is as follows:

$to = $form[address1];
$subject = "E-mail Verification";
$body = 'The first line\n';
$body .= 'The second line.';
$headers = 'From: we*******@example.com';
$res = mail($to, $subject, $body, $headers);
The domain example.com has no MX records and no mail server running
on the host pointed at by the A record. This is more than sufficient
to drop any mail claiming to be from example.com as SPAM.

What mail server are you using to send the mail? (Examine your settings
or the default ones and make sure they are appropriate.) Local sendmail?
Look at its logs. Did a message come in at all?
>I tried to send messages to two different e-mail addresses (to my yahoo
account and on my university one). No one mail-box got the message. I
also checked the bulk folder of the yahoo mail, it is also empty. Gould
you please help me to solve this problem?
Nov 26 '06 #5

P: n/a
Gordon Burditt wrote:
>>I have a problem with the function "mail". It returns "true"
but supposed recipients receive nothing. My code is as follows:

$to = $form[address1];
$subject = "E-mail Verification";
$body = 'The first line\n';
$body .= 'The second line.';
$headers = 'From: we*******@example.com';
$res = mail($to, $subject, $body, $headers);


The domain example.com has no MX records and no mail server running
on the host pointed at by the A record. This is more than sufficient
to drop any mail claiming to be from example.com as SPAM.

What mail server are you using to send the mail? (Examine your settings
or the default ones and make sure they are appropriate.) Local sendmail?
Look at its logs. Did a message come in at all?

>>I tried to send messages to two different e-mail addresses (to my yahoo
account and on my university one). No one mail-box got the message. I
also checked the bulk folder of the yahoo mail, it is also empty. Gould
you please help me to solve this problem?

Gordon,

I suspect he was doing exactly as recommended - using example.com when
posting an example, instead of a real email address which could be
harvested by spammers.

I do exactly the same thing when posting code. That's what example.com
is reserved for.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 27 '06 #6

P: n/a
"Gordon Burditt" <go***********@burditt.orgpíše v diskusním příspěvku
news:12*************@corp.supernews.com...
I have a problem with the function "mail". It returns "true"
but supposed recipients receive nothing. My code is as follows:

$to = $form[address1];
$subject = "E-mail Verification";
$body = 'The first line\n';
$body .= 'The second line.';
$headers = 'From: we*******@example.com';
$res = mail($to, $subject, $body, $headers);

The domain example.com has no MX records and no mail server running
on the host pointed at by the A record. This is more than sufficient
to drop any mail claiming to be from example.com as SPAM.
Here you see the reason of your problem :-)
For example if you are sending mail from domain www.superhost.com then you
must use some like
$headers = 'From: go****@superhost.com';
In other word the part of mail after "@" must be the same as your domain
name after "www."
--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Nov 27 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.