php mail() function
am 22.10.2009 23:56:55 von James Prentice
I'm trying to use the php mail() function to send a mail within a php
script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
script runs fine and the return value of the mail function is TRUE,
but the mail is never received. I'm trying to send an email to my
gmail account via the local server on my machine, just to test if this
script works.
I installed postfix because I read in several places that people have
had good luck with that mail program. From what I can tell, postfix is
working. I can do:
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 homemade ESMTP Postfix (Ubuntu)
ehlo localhost
250-homemade
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
After the php script runs, I type 'mailq' and get the result 'mail
queue is empty.' If I check /var/log/mail.log, this is what I see:
Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=33
from=
Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
message-id=<20091022065435.2A31EA70109@homemade>
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
from=, size=499, nrcpt=1 (queue active)
Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
dsn=5.0.0, status=bounced (gmail.com)
Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
message-id=<20091022065435.3217DA7010A@homemade>
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=<>,
size=2095, nrcpt=1 (queue active)
Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
non-delivery notification: 3217DA7010A
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
to=, relay=local, delay=0.03, delays=0/0.02/0/0.01,
dsn=2.0.0, status=sent (delivered to command: procmail -a
"$EXTENSION")
Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed
Any ideas? I am new both to php and postfix. Thanks for any help.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 01:15:49 von LinuxManMikeC
The problem is you won't be trusted to deliver mail directly to most
mail servers unless you have a static IP. Even then thats no
guarantee. What you have to do is relay through your ISP's SMTP
server where you're "trusted". You should also be able to setup PHP
to use your ISP's SMTP server and never touch the SMTP service on your
local machine (if you don't feel like playing with Postfix).
On Thu, Oct 22, 2009 at 3:56 PM, James Prentice wrote:
> I'm trying to use the php mail() function to send a mail within a php
> script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
> script runs fine and the return value of the mail function is TRUE,
> but the mail is never received. I'm trying to send an email to my
> gmail account via the local server on my machine, just to test if this
> script works.
>
> I installed postfix because I read in several places that people have
> had good luck with that mail program. From what I can tell, postfix is
> working. I can do:
>
> telnet localhost 25
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 homemade ESMTP Postfix (Ubuntu)
> ehlo localhost
> 250-homemade
> 250-PIPELINING
> 250-SIZE 10240000
> 250-VRFY
> 250-ETRN
> 250-STARTTLS
> 250-ENHANCEDSTATUSCODES
> 250-8BITMIME
> 250 DSN
>
> After the php script runs, I type 'mailq' and get the result 'mail
> queue is empty.' If I check /var/log/mail.log, this is what I see:
>
> Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=33
> from=
> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
> message-id=<20091022065435.2A31EA70109@homemade>
> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
> from=, size=499, nrcpt=1 (queue active)
> Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
> to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
> dsn=5.0.0, status=bounced (gmail.com)
> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
> message-id=<20091022065435.3217DA7010A@homemade>
> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=<>,
> size=2095, nrcpt=1 (queue active)
> Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
> non-delivery notification: 3217DA7010A
> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
> Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
> to=, relay=local, delay=0.03, delays=0/0.02/0/0.01,
> dsn=2.0.0, status=sent (delivered to command: procmail -a
> "$EXTENSION")
> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed
>
> Any ideas? I am new both to php and postfix. Thanks for any help.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 03:24:14 von James Prentice
How would I determine my ISP's SMPT server ID? And do I need to edit
main.cf in order to use that server?
Also, is there a way to test the script just sending an email locally?
I tried sending the email to userid@localhost, but the email was still
not received.
On Thu, Oct 22, 2009 at 4:15 PM, LinuxManMikeC wr=
ote:
> The problem is you won't be trusted to deliver mail directly to most
> mail servers unless you have a static IP. =A0Even then thats no
> guarantee. =A0What you have to do is relay through your ISP's SMTP
> server where you're "trusted". =A0You should also be able to setup PHP
> to use your ISP's SMTP server and never touch the SMTP service on your
> local machine (if you don't feel like playing with Postfix).
>
> On Thu, Oct 22, 2009 at 3:56 PM, James Prentice =
wrote:
>> I'm trying to use the php mail() function to send a mail within a php
>> script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
>> script runs fine and the return value of the mail function is TRUE,
>> but the mail is never received. I'm trying to send an email to my
>> gmail account via the local server on my machine, just to test if this
>> script works.
>>
>> I installed postfix because I read in several places that people have
>> had good luck with that mail program. From what I can tell, postfix is
>> working. I can do:
>>
>> telnet localhost 25
>> Trying 127.0.0.1...
>> Connected to localhost.
>> Escape character is '^]'.
>> 220 homemade ESMTP Postfix (Ubuntu)
>> ehlo localhost
>> 250-homemade
>> 250-PIPELINING
>> 250-SIZE 10240000
>> 250-VRFY
>> 250-ETRN
>> 250-STARTTLS
>> 250-ENHANCEDSTATUSCODES
>> 250-8BITMIME
>> 250 DSN
>>
>> After the php script runs, I type 'mailq' and get the result 'mail
>> queue is empty.' If I check /var/log/mail.log, this is what I see:
>>
>> Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=3D33
>> from=3D
>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
>> message-id=3D<20091022065435.2A31EA70109@homemade>
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
>> from=3D, size=3D499, nrcpt=3D1 (queue active)
>> Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
>> to=3D, relay=3Dnone, delay=3D0.04, delays=3D0.03/0/0/0.01=
,
>> dsn=3D5.0.0, status=3Dbounced (gmail.com)
>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
>> message-id=3D<20091022065435.3217DA7010A@homemade>
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=3D<>,
>> size=3D2095, nrcpt=3D1 (queue active)
>> Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
>> non-delivery notification: 3217DA7010A
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
>> Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
>> to=3D, relay=3Dlocal, delay=3D0.03, delays=3D0/0.02/0=
/0.01,
>> dsn=3D2.0.0, status=3Dsent (delivered to command: procmail -a
>> "$EXTENSION")
>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed
>>
>> Any ideas? I am new both to php and postfix. Thanks for any help.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 06:19:35 von Paul M Foster
On Thu, Oct 22, 2009 at 06:24:14PM -0700, James Prentice wrote:
> How would I determine my ISP's SMPT server ID? And do I need to edit
> main.cf in order to use that server?
What ID? There's no ID needed. You just configure postfix to relay any
non-local mail sent to it to the SMTP server at your ISP. Check the
headers in incoming mail sent to you for the name of that server. It's
likely the same for both incoming and outgoing mail. Something like
mail.myisp.com.
One other note. People look at me like I'm crazy when I mention this,
but I've seen it quite a bit at various internet mail servers.
Sometimes, in order to accept email from you, the internet mail server
must see you *receive* mail within a certain time period prior. That is,
you have to go fetch your mail at the ISP, which opens a "window" into
the SMTP server for a limited time. Then you can tender mail to the
internet mail server. I don't know that your internet mail server
operates this way, but it's something to consider. I've had to deal with
this before myself.
Configuring local SMTP servers, like postfix. Check and see if Ubuntu
has some sort of setup utility for this. Or try
dpkg-reconfigure postfix
Setting up mail servers is tedious and error prone, unless you've done
it a lot. Read The Fine Manual on postfix.
>
> Also, is there a way to test the script just sending an email locally?
> I tried sending the email to userid@localhost, but the email was still
> not received.
>
It will work, assuming three things:
1. You have an actual user set up on the system to receive mail. That
is, an actual user on the system, with an entry in the passwd file and a
home directory, etc.
2. Postfix is configured to deliver truly local mail to local addresses.
More postfix configuration fun.
3. Postfix is actually running and properly configured. If not
configured properly, it may refuse to run.
In any case, linuxmanmikec's comment about the internet mail server not
trusting you on a dynamic IP is spot on. The web of email trust is such
that internet mail servers only trust other internet mail servers. And
*your* internet mail server will trust *you*. So to get mail to that
other internet mail server over there, you'll have to give it to *your*
internet mail server, which is the only one that internet mail server
over there will trust. The "bounce" message you got indicates that
relaying from you is forbidden at the destination mail server.
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 06:40:34 von Shawn McKenzie
Paul M Foster wrote:
> On Thu, Oct 22, 2009 at 06:24:14PM -0700, James Prentice wrote:
>
> One other note. People look at me like I'm crazy when I mention this,
> but I've seen it quite a bit at various internet mail servers.
> Sometimes, in order to accept email from you, the internet mail server
> must see you *receive* mail within a certain time period prior. That is,
> you have to go fetch your mail at the ISP, which opens a "window" into
> the SMTP server for a limited time. Then you can tender mail to the
> internet mail server. I don't know that your internet mail server
> operates this way, but it's something to consider. I've had to deal with
> this before myself.
This is commonly known as POP lock and is one of the two main ways that
a mail server allows you to relay a message. If you have authenticated
via POP3 (i.e. checked your mail) in a certain period of time then the
SMTP server will let you send. The other main one is by authentication
(username/password) with the SMTP server when you attempt to send mail.
> In any case, linuxmanmikec's comment about the internet mail server not
> trusting you on a dynamic IP is spot on. The web of email trust is such
> that internet mail servers only trust other internet mail servers. And
> *your* internet mail server will trust *you*. So to get mail to that
> other internet mail server over there, you'll have to give it to *your*
> internet mail server, which is the only one that internet mail server
> over there will trust. The "bounce" message you got indicates that
> relaying from you is forbidden at the destination mail server.
>
This is fairly accurate in premise but just to clarify. Mailservers
don't operate like this by default and there is really no "trust".
There are public blacklists that a mailserver can be configured to use
that tell the mailserver not to accept mail from servers on the
blacklist. The blacklists may contain servers that allow anyone to
relay email, compromised servers, servers known for spam, ip ranges
known to be held by spammers and *ranges that ISPs designate as dynamic
or used for subscribers (DSL, cable, dial-up customers, etc. because
they shouldn't be relaying email).
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 07:46:13 von Paul M Foster
On Thu, Oct 22, 2009 at 11:40:34PM -0500, Shawn McKenzie wrote:
> This is fairly accurate in premise but just to clarify. Mailservers
> don't operate like this by default and there is really no "trust".
> There are public blacklists that a mailserver can be configured to use
> that tell the mailserver not to accept mail from servers on the
> blacklist. The blacklists may contain servers that allow anyone to
> relay email, compromised servers, servers known for spam, ip ranges
> known to be held by spammers and *ranges that ISPs designate as dynamic
> or used for subscribers (DSL, cable, dial-up customers, etc. because
> they shouldn't be relaying email).
Regarding the rejection of dynamic IPs by smarthosts, are you saying
that it's a "blacklist" of sorts that lets them know an IP is dynamic?
(Serious question. I don't know the mechanism by which they determine
what is and isn't a dynamic IP.)
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 08:03:16 von kranthi
i faced the same problem quite a few times.
the general email route is
php script -> sender smtp server -> receiving mail server
in your case path 2 is broken. meaning port 25 is blocked by your ISP
the work around is:
1. see if your ISP provides you with an SMTP account that is not blocked (OR)
2. try using a socks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 23.10.2009 14:02:35 von Skylinux
Paul M Foster wrote:
> Regarding the rejection of dynamic IPs by smarthosts, are you saying
> that it's a "blacklist" of sorts that lets them know an IP is dynamic?
> (Serious question. I don't know the mechanism by which they determine
> what is and isn't a dynamic IP.)
I run my own mail server and use the zen blocklist from spamhaus.org.
The zen list combines all the the anti spam lists plus all IPs
designated to end users (http://www.spamhaus.org/zen/)
The reason for blocking end users is that a lot of SPAM is sent out by
compromised machines from some home Internet connection. I am currently
getting about 5 connections every 2 seconds from compromised computers
attempting to spam my server. The origin is usually a dynamically
assigned IP from Sprint or Comcast (USA ISPs).
So blocking the end users from sending SPAM tends to cut down on a LOT
of junk.
Here is a bit more info about the end user blocklist.
http://www.spamhaus.org/pbl/
--
John
Question / Answer based CAPTCHA
http://www.network-technologies.org/tiny.php?id=1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: php mail() function
am 23.10.2009 14:31:05 von Bob McConnell
From: Paul M Foster
> Regarding the rejection of dynamic IPs by smarthosts, are you saying
> that it's a "blacklist" of sorts that lets them know an IP is dynamic?
> (Serious question. I don't know the mechanism by which they determine
> what is and isn't a dynamic IP.)
You are talking about two different mechanisms here. The black or grey
lists are services that track known open relays and other sources of
spam, viruses and assorted malware. Anyone can subscribe to them and use
them to validate relay requests.
There are also services that keep track of valid domain addresses and
the IP assigned to them. They are usually called DNS hosts. These can be
polled to identify the IP address for authorized domains and hosts.
There are even special records for the email severs within a domain.
Most dynamically allocated IP addresses will not show up on these
servers unless you have access to a service authorized to inject
records.
So basically, qmail did a DNS lookup on your host/domain name and did
not find a record pointing to your server. Therefore it rejected your
request.
You will have to ask your ISP for the address of their SMTP and POP
servers if you don't know them. But usually your email client is already
configured to talk to them. I would just go into my Thunderbird setup
and look up those addresses.
Bob McConnell
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 06:11:25 von James Prentice
I found the mail server for my ISP (shawmail.vc.shawcable.net) and
edited main.cf in the following manner:
myhostname =3D shawcable.net
relayhost =3D [shawmail.vc.shawcable.net]
I still don't receive the mail from the PHP script though. The error
log from /var/log/mail.log is this:
Oct 23 21:00:31 homemade postfix/pickup[7044]: 6CA44A70109: uid=3D33
from=3D
Oct 23 21:00:31 homemade postfix/cleanup[7107]: 6CA44A70109:
message-id=3D<20091024040031.6CA44A70109@shawcable.net>
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 6CA44A70109:
from=3D, size=3D527, nrcpt=3D1 (queue active)
Oct 23 21:00:31 homemade postfix/error[7109]: 6CA44A70109:
to=3D, relay=3Dnone, delay=3D0.04, delays=3D0.03/0/0/0.01,
dsn=3D5.0.0, status=3Dbounced ([shawmail.vc.shawcable.net])
Oct 23 21:00:31 homemade postfix/cleanup[7107]: 75517A7010A:
message-id=3D<20091024040031.75517A7010A@shawcable.net>
Oct 23 21:00:31 homemade postfix/bounce[7110]: 6CA44A70109: sender
non-delivery notification: 75517A7010A
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 75517A7010A: from=3D<>,
size=3D2219, nrcpt=3D1 (queue active)
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 6CA44A70109: removed
Oct 23 21:00:31 homemade postfix/error[7109]: 75517A7010A:
to=3D, relay=3Dnone, delay=3D0.03,
delays=3D0.02/0/0/0.01, dsn=3D5.0.0, status=3Dbounced
([shawmail.vc.shawcable.net])
Oct 23 21:00:31 homemade postfix/qmgr[7045]: 75517A7010A: removed
Have I edited main.cf incorrectly, or are there other values that need
to be edited?
Cheers
On Thu, Oct 22, 2009 at 6:24 PM, James Prentice wr=
ote:
> How would I determine my ISP's SMPT server ID? And do I need to edit
> main.cf in order to use that server?
>
> Also, is there a way to test the script just sending an email locally?
> I tried sending the email to userid@localhost, but the email was still
> not received.
>
>
>
> On Thu, Oct 22, 2009 at 4:15 PM, LinuxManMikeC =
wrote:
>> The problem is you won't be trusted to deliver mail directly to most
>> mail servers unless you have a static IP. =A0Even then thats no
>> guarantee. =A0What you have to do is relay through your ISP's SMTP
>> server where you're "trusted". =A0You should also be able to setup PHP
>> to use your ISP's SMTP server and never touch the SMTP service on your
>> local machine (if you don't feel like playing with Postfix).
>>
>> On Thu, Oct 22, 2009 at 3:56 PM, James Prentice =
wrote:
>>> I'm trying to use the php mail() function to send a mail within a php
>>> script. This is using PHP 5.2.4 and Ubuntu Hardy Heron linux. The
>>> script runs fine and the return value of the mail function is TRUE,
>>> but the mail is never received. I'm trying to send an email to my
>>> gmail account via the local server on my machine, just to test if this
>>> script works.
>>>
>>> I installed postfix because I read in several places that people have
>>> had good luck with that mail program. From what I can tell, postfix is
>>> working. I can do:
>>>
>>> telnet localhost 25
>>> Trying 127.0.0.1...
>>> Connected to localhost.
>>> Escape character is '^]'.
>>> 220 homemade ESMTP Postfix (Ubuntu)
>>> ehlo localhost
>>> 250-homemade
>>> 250-PIPELINING
>>> 250-SIZE 10240000
>>> 250-VRFY
>>> 250-ETRN
>>> 250-STARTTLS
>>> 250-ENHANCEDSTATUSCODES
>>> 250-8BITMIME
>>> 250 DSN
>>>
>>> After the php script runs, I type 'mailq' and get the result 'mail
>>> queue is empty.' If I check /var/log/mail.log, this is what I see:
>>>
>>> Oct 21 23:54:35 homemade postfix/pickup[5735]: 2A31EA70109: uid=3D33
>>> from=3D
>>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 2A31EA70109:
>>> message-id=3D<20091022065435.2A31EA70109@homemade>
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109:
>>> from=3D, size=3D499, nrcpt=3D1 (queue active)
>>> Oct 21 23:54:35 homemade postfix/error[7999]: 2A31EA70109:
>>> to=3D, relay=3Dnone, delay=3D0.04, delays=3D0.03/0/0/0.0=
1,
>>> dsn=3D5.0.0, status=3Dbounced (gmail.com)
>>> Oct 21 23:54:35 homemade postfix/cleanup[7997]: 3217DA7010A:
>>> message-id=3D<20091022065435.3217DA7010A@homemade>
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: from=3D<>,
>>> size=3D2095, nrcpt=3D1 (queue active)
>>> Oct 21 23:54:35 homemade postfix/bounce[8000]: 2A31EA70109: sender
>>> non-delivery notification: 3217DA7010A
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 2A31EA70109: removed
>>> Oct 21 23:54:35 homemade postfix/local[8001]: 3217DA7010A:
>>> to=3D, relay=3Dlocal, delay=3D0.03, delays=3D0/0.02/=
0/0.01,
>>> dsn=3D2.0.0, status=3Dsent (delivered to command: procmail -a
>>> "$EXTENSION")
>>> Oct 21 23:54:35 homemade postfix/qmgr[5736]: 3217DA7010A: removed
>>>
>>> Any ideas? I am new both to php and postfix. Thanks for any help.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 06:21:04 von kranthi
i never worked with postfix, but form my experience with hmail server
i can say that you need to relay through a mail account of ISP(not the
server itself)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 06:51:44 von Paul M Foster
On Fri, Oct 23, 2009 at 09:11:25PM -0700, James Prentice wrote:
> I found the mail server for my ISP (shawmail.vc.shawcable.net) and
> edited main.cf in the following manner:
>
> myhostname = shawcable.net
> relayhost = [shawmail.vc.shawcable.net]
>
> I still don't receive the mail from the PHP script though. The error
> log from /var/log/mail.log is this:
>
> Oct 23 21:00:31 homemade postfix/pickup[7044]: 6CA44A70109: uid=33
> from=
> Oct 23 21:00:31 homemade postfix/cleanup[7107]: 6CA44A70109:
> message-id=<20091024040031.6CA44A70109@shawcable.net>
> Oct 23 21:00:31 homemade postfix/qmgr[7045]: 6CA44A70109:
> from=, size=527, nrcpt=1 (queue active)
> Oct 23 21:00:31 homemade postfix/error[7109]: 6CA44A70109:
> to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
> dsn=5.0.0, status=bounced ([shawmail.vc.shawcable.net])
> Oct 23 21:00:31 homemade postfix/cleanup[7107]: 75517A7010A:
> message-id=<20091024040031.75517A7010A@shawcable.net>
> Oct 23 21:00:31 homemade postfix/bounce[7110]: 6CA44A70109: sender
> non-delivery notification: 75517A7010A
> Oct 23 21:00:31 homemade postfix/qmgr[7045]: 75517A7010A: from=<>,
> size=2219, nrcpt=1 (queue active)
> Oct 23 21:00:31 homemade postfix/qmgr[7045]: 6CA44A70109: removed
> Oct 23 21:00:31 homemade postfix/error[7109]: 75517A7010A:
> to=, relay=none, delay=0.03,
> delays=0.02/0/0/0.01, dsn=5.0.0, status=bounced
> ([shawmail.vc.shawcable.net])
> Oct 23 21:00:31 homemade postfix/qmgr[7045]: 75517A7010A: removed
>
> Have I edited main.cf incorrectly, or are there other values that need
> to be edited?
1. Not sure why you have square brackets around the relayhost value.
2. You're getting a bounce from the ISP's mail server, one indicating it
still won't allow relay.
3. I suspect the relayhost name is wrong. This may be the name you find
in the mail headers on messages relayed to you, but I doubt it's the one
you should use to post to. I could be wrong, though.
4. All due respect to Kranthi, but I believe he's wrong about relaying
mail from your webserver to the ISP's mailserver. I believe the ISP's
mailserver doesn't care, as long as the mail comes from your "pipe". You
could probably call yourself "pizza@pepperoni.com" and your ISP would
accept it. It's just the From:. Again, I could be wrong.
5. This would be a lot simpler if you just call Shaw and ask them for
the name of the mailserver, and ask them if it's a problem for you to
post mail from your internal webserver to their mailserver. Then ask
them why such posts might bounce with a 5XX error.
Paul
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 11:11:35 von Skylinux
Paul M Foster wrote:
> 4. All due respect to Kranthi, but I believe he's wrong about relaying
> mail from your webserver to the ISP's mailserver. I believe the ISP's
> mailserver doesn't care, as long as the mail comes from your "pipe". You
> could probably call yourself "pizza@pepperoni.com" and your ISP would
> accept it. It's just the From:. Again, I could be wrong.
All the ISPs I have used so far require the user to authenticate even
when on the same network.
So if you want to relay through the SMTP server of your ISP you need to
login first. I think that is what Kranthi said
Try this:
1) Set up a password maps file (/etc/postfix/sasl_passwd) with the content:
mail.ispserver.com username:password
Now Execute these commands
# chown root:root /etc/postfix/sasl_passwd
# chmod 600 /etc/postfix/sasl_passwd
# postmap /etc/postfix/sasl_passwd
And change your config to this /etc/postfix/main.cf:
relayhost = mail.ispserver.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
Now reload postfix and try it again.
# postfix reload
--
John
Question / Answer based CAPTCHA
http://www.network-technologies.org/tiny.php?id=1
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 22:00:00 von James Prentice
Thanks, John. I set up the sasl_passwd file as per your instructions
but am still getting status=bounced. I'm wondering, what should the
values in main.cf be for 'myhostname' and 'mydestination'?
These pages give some info on the Shaw mail servers, but I'm not
certain which I should be using:
http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Reside ntial/Email/ServiceDetails.htm
http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Reside ntial/RoutersandShawServerNames.htm
Also, I notice that in the mail.log file, the 'from:' value is
'www-data@homemade'. The actual 'from:' value is provided to the php
mail() function via a web form, so should be somebody's email address
(e.g. my own in this case).
from=, size=523, nrcpt=1 (queue active)
Oct 24 12:49:40 homemade postfix/error[7530]: B80B7A70109:
to=, relay=none, delay=0.04, delays=0.03/0/0/0.01,
dsn=5.0.0, status=bounced (shawmail)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 22:27:48 von Skylinux
James Prentice wrote:
> Also, I notice that in the mail.log file, the 'from:' value is
> 'www-data@homemade'. The actual 'from:' value is provided to the php
> mail() function via a web form, so should be somebody's email address
> (e.g. my own in this case).
I think PHP will use the apache user and domain to generate the email
address. I use my own smtp function so I can't say for certain.
One thing you could try is to use a valid email account on the server
for the FROM address so that you can receive the bounced message. The
actual message should contain more information.
Alternatively attempt to increase the loglevel of postfix so you get
exact feedback of why the connection is failing.
As far as which server to use. I think this page lists the correct one:
http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Reside ntial/RoutersandShawServerNames.htm
--
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 23:01:12 von James Prentice
It sends the bounced message to /var/mail/www-data and I get this:
--19BE8A70109.1256417846/homemade
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; homemade
X-Postfix-Queue-ID: 19BE8A70109
X-Postfix-Sender: rfc822; www-data@homemade
Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
Final-Recipient: rfc822; xxx@shaw.ca
Action: failed
Status: 5.0.0
Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net
--19BE8A70109.1256417846/homemade
Content-Description: Undelivered Message
Content-Type: message/rfc822
Received: by homemade (Postfix, from userid 33)
id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
To: xxx@shaw.ca
I will investigate how to change the loglevel of postfix, because
right now the error messages don't seem very helpful (at least to me).
Cheers
On Sat, Oct 24, 2009 at 1:27 PM, John Black
wrote:
> James Prentice wrote:
> =A0> Also, I notice that in the mail.log file, the 'from:' value is
>>
>> 'www-data@homemade'. The actual 'from:' value is provided to the php
>> mail() function via a web form, so should be somebody's email address
>> (e.g. my own in this case).
>
> I think PHP will use the apache user and domain to generate the email
> address. I use my own smtp function so I can't say for certain.
>
> One thing you could try is to use a valid email account on the server for
> the FROM address so that you can receive the bounced message. The actual
> message should contain more information.
> Alternatively attempt to increase the loglevel of postfix so you get exac=
t
> feedback of why the connection is failing.
>
> As far as which server to use. I think this page lists the correct one:
> http://www.shaw.ca/en-ca/CustomerCare/InternetSupport/Reside ntial/Routers=
andShawServerNames.htm
>
> --
> John
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 24.10.2009 23:20:09 von Per olof Ljungmark
James Prentice wrote:
> It sends the bounced message to /var/mail/www-data and I get this:
>
> --19BE8A70109.1256417846/homemade
> Content-Description: Delivery report
> Content-Type: message/delivery-status
>
> Reporting-MTA: dns; homemade
> X-Postfix-Queue-ID: 19BE8A70109
> X-Postfix-Sender: rfc822; www-data@homemade
> Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>
> Final-Recipient: rfc822; xxx@shaw.ca
> Action: failed
> Status: 5.0.0
> Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net
>
> --19BE8A70109.1256417846/homemade
> Content-Description: Undelivered Message
> Content-Type: message/rfc822
>
> Received: by homemade (Postfix, from userid 33)
> id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
> To: xxx@shaw.ca
Although 5.0.0 actually means something else I'm pretty sure you are
rejected because of an invalid sender address or domain. Use a sender
address that is valid with your ISP's mail relay.
Just my $0.02
--
per
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 25.10.2009 05:17:16 von James Prentice
I also suspect that the problem is due to the sender address, but I
have tried using the shaw email address for the From: address that's
given to the mail() function and it still gets bounced. It seems like
the ISP should consider that address valid.
On Sat, Oct 24, 2009 at 2:20 PM, Per olof Ljungmark wrote=
:
> James Prentice wrote:
>>
>> It sends the bounced message to /var/mail/www-data and I get this:
>>
>> --19BE8A70109.1256417846/homemade
>> Content-Description: Delivery report
>> Content-Type: message/delivery-status
>>
>> Reporting-MTA: dns; homemade
>> X-Postfix-Queue-ID: 19BE8A70109
>> X-Postfix-Sender: rfc822; www-data@homemade
>> Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>>
>> Final-Recipient: rfc822; xxx@shaw.ca
>> Action: failed
>> Status: 5.0.0
>> Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net
>>
>> --19BE8A70109.1256417846/homemade
>> Content-Description: Undelivered Message
>> Content-Type: message/rfc822
>>
>> Received: by homemade (Postfix, from userid 33)
>> =A0 =A0 =A0 =A0id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>> To: xxx@shaw.ca
>
> Although 5.0.0 actually means something else I'm pretty sure you are
> rejected because of an invalid sender address or domain. Use a sender
> address that is valid with your ISP's mail relay.
>
> Just my $0.02
>
> --
> per
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 25.10.2009 05:28:51 von James Prentice
But it seems like the 'From:' address being given to the PHP mail()
function is maybe being ignored, because the error log lists
'www-data@homemade' as being the sender, rather than listing the shaw
address.
The snippet from the PHP code:
$email =3D $_POST['email'];
....
mail($to, $subject, $msg, 'From:' . $email);
I have tried setting both $to and $email to be the same shaw address
since I assumed it should be recognized by the mail server, but it's
still getting bounced. So why is 'www-data@homemade' being listed as
the sender? Any ideas?
On Sat, Oct 24, 2009 at 9:17 PM, James Prentice wr=
ote:
> I also suspect that the problem is due to the sender address, but I
> have tried using the shaw email address for the From: address that's
> given to the mail() function and it still gets bounced. It seems like
> the ISP should consider that address valid.
>
>
>
> On Sat, Oct 24, 2009 at 2:20 PM, Per olof Ljungmark wro=
te:
>> James Prentice wrote:
>>>
>>> It sends the bounced message to /var/mail/www-data and I get this:
>>>
>>> --19BE8A70109.1256417846/homemade
>>> Content-Description: Delivery report
>>> Content-Type: message/delivery-status
>>>
>>> Reporting-MTA: dns; homemade
>>> X-Postfix-Queue-ID: 19BE8A70109
>>> X-Postfix-Sender: rfc822; www-data@homemade
>>> Arrival-Date: Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>>>
>>> Final-Recipient: rfc822; xxx@shaw.ca
>>> Action: failed
>>> Status: 5.0.0
>>> Diagnostic-Code: X-Postfix; shawmail.vc.shawcable.net
>>>
>>> --19BE8A70109.1256417846/homemade
>>> Content-Description: Undelivered Message
>>> Content-Type: message/rfc822
>>>
>>> Received: by homemade (Postfix, from userid 33)
>>> =A0 =A0 =A0 =A0id 19BE8A70109; Sat, 24 Oct 2009 13:57:26 -0700 (PDT)
>>> To: xxx@shaw.ca
>>
>> Although 5.0.0 actually means something else I'm pretty sure you are
>> rejected because of an invalid sender address or domain. Use a sender
>> address that is valid with your ISP's mail relay.
>>
>> Just my $0.02
>>
>> --
>> per
>>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: php mail() function
am 26.10.2009 13:37:59 von Bob McConnell
From: James Prentice
> I have tried setting both $to and $email to be the same shaw address
> since I assumed it should be recognized by the mail server, but it's
> still getting bounced. So why is 'www-data@homemade' being listed as
> the sender? Any ideas?
I strongly recommend you call the help desk at Shaw and ask them to
explain what is happening. They should know what is going on with their
servers. Everyone on this list appears to be guessing at the problem,
which is not likely to help you.
Bob McConnell
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 26.10.2009 15:23:20 von Skylinux
Bob McConnell wrote:
> I strongly recommend you call the help desk at Shaw and ask them to
> explain what is happening. They should know what is going on with their
> servers. Everyone on this list appears to be guessing at the problem,
> which is not likely to help you.
But they are educated guesses :)
No seriously, without a definitive error message it is hard to say for sure.
Since he only needs postfix on the server to allow php to email out I
may have a different solution for him.
I sent him my custom smtp_email function which talks to the ISPs SMTP
server directly and supports authentication.
Lets see if that help.
--
John
Nur wer im Wohlstand lebt, schimpft auf ihn.
[Ludwig Marcuse]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 25.11.2009 19:58:37 von James Prentice
After a long delay, I've finally got mail working. I had decided to
move on in the book that I'm working through (Head First PHP & MySQL)
but doubled back to address the mail issue again. This is how I
finally got it to work:
1. Switched to XAMPP for linux rather than using my existing versions
of mysql, php and apache.
2. Uninstalled Postfix and reinstalled Sendmail. Then I followed the
instructions here:
http://dbaron.org/linux/sendmail
I can't vouch that the method described at that link is completely
safe and secure, but it worked for me and was very easy. I've spent
many hours and days trying to get this to work so am very relieved.
My only complaint is that there is quite a long delay after submitting
report.html (from Ch. 1) while it says 'waiting for localhost...'. It
can take up to 20 seconds or so before sending and giving
confirmation.
Thanks for all your help.
On Mon, Oct 26, 2009 at 4:37 AM, Bob McConnell wrote:
> From: James Prentice
>
>> I have tried setting both $to and $email to be the same shaw address
>> since I assumed it should be recognized by the mail server, but it's
>> still getting bounced. So why is 'www-data@homemade' being listed as
>> the sender? Any ideas?
>
> I strongly recommend you call the help desk at Shaw and ask them to
> explain what is happening. They should know what is going on with their
> servers. Everyone on this list appears to be guessing at the problem,
> which is not likely to help you.
>
> Bob McConnell
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: php mail() function
am 25.11.2009 20:26:29 von James Prentice
It looks like using XAMPP wasn't strictly necessary. I tried running
this example again using my previous versions of mysql and apache and
it worked fine. So the key is to configure Sendmail as described at
the URL I gave.
On Wed, Nov 25, 2009 at 10:58 AM, James Prentice wrote:
> After a long delay, I've finally got mail working. I had decided to
> move on in the book that I'm working through (Head First PHP & MySQL)
> but doubled back to address the mail issue again. This is how I
> finally got it to work:
>
> 1. Switched to XAMPP for linux rather than using my existing versions
> of mysql, php and apache.
>
> 2. Uninstalled Postfix and reinstalled Sendmail. Then I followed the
> instructions here:
>
> http://dbaron.org/linux/sendmail
>
> I can't vouch that the method described at that link is completely
> safe and secure, but it worked for me and was very easy. I've spent
> many hours and days trying to get this to work so am very relieved.
>
> My only complaint is that there is quite a long delay after submitting
> report.html (from Ch. 1) while it says 'waiting for localhost...'. It
> can take up to 20 seconds or so before sending and giving
> confirmation.
>
> Thanks for all your help.
>
> On Mon, Oct 26, 2009 at 4:37 AM, Bob McConnell wrote:
>> From: James Prentice
>>
>>> I have tried setting both $to and $email to be the same shaw address
>>> since I assumed it should be recognized by the mail server, but it's
>>> still getting bounced. So why is 'www-data@homemade' being listed as
>>> the sender? Any ideas?
>>
>> I strongly recommend you call the help desk at Shaw and ask them to
>> explain what is happening. They should know what is going on with their
>> servers. Everyone on this list appears to be guessing at the problem,
>> which is not likely to help you.
>>
>> Bob McConnell
>>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php