PDA

View Full Version : php mail error


rosa hsiao
8th December 2005, 11:21
The following php function works fine in another RedHat 9 server using sendmain without ISPConfig.

<?
(mail ("sales01@test2.com", "PHP mail Testing....", "How are you?"));
?>

"test2.com" is another domain hosted in RedHat 9 server.

but the above php function doesn' t work in Fedora 3 using postfix with ISPConfig installed in domain "test.com".
There is no problem receiving or sending emails with webmail using "sales01@test.com" (web07_sales01) account.

I have the following lines in main.cf:

mydomain = test.com
myorgin = $mydomain
inet_interfaces = all
# local_recipient_maps =
#local_recipient_maps =
mynetworks_style = subnet
#relayhost = $mydomain
#relay_recipient_maps = hash:/etc/postfix/relay_recipients
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
mail.$mydomain, www.$mydomain, ftp.$mydomain
mydestination = /etc/postfix/local-host-names
virtual_maps = hash:/etc/postfix/virtusertable
virtual_mailbox_domains = hash:/etc/postfix/vmaildomains
relay_domains = $#mydestination
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,check_ relay_domains
home_mailbox = Mailbox
virtual_mailbox_base = /var/spool/virtual
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_mailbox_domains = hash:/etc/postfix/vmaildomains
virtual_uid_maps = static:200
virtual_gid_maps = static:200
virtual_mailbox_lock = dotlock
virtual_minimum_uid = 200

But when I run

telnet localhost 25
and then issue
ehlo localhost

I don't see a line starting with 250-AUTH.


Any suggestion?

till
8th December 2005, 12:03
Please check your maillog for errors. Can you send emails to other domains outside this server with the php mail function?

falko
8th December 2005, 12:45
Please post the exact output of telnet localhost 25

rosa hsiao
8th December 2005, 14:39
Please check your maillog for errors. Can you send emails to other domains outside this server with the php mail function?

No. I can't send emails to other domains outside this server (e.g. bytelib@ms2.hinet.net) with the php mail function. When I run the function in the browser,nothing happens at all.

But,when I use webmail to send email with pink@test.com to bytelib@ms2.hinet.net,it can send out the mail and receive reply from bytelib@ms2.hinet.net.

Here is the telnet message:

[root@server1~]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1)
Escape character is '^]'.
220 server1.test.com ESMTP Postfix
ehlo localhost
250-server1.test.com
250-PIPELINING
250-VRFY
250-ETRN
250-8BITMIME

Here is the /var/log/maillog message:

Dec 8 20:07:31 server1 postfix/postfix-script: starting the Postfix mail system
Dec 8 20:07:31 server1 postfix/master[3429]: daemon started -- version 2.1.5
Dec 8 20:07:31 server1 postfix/qmgr[3440]: C6C391268059: from=<apache@server1.test.com>, size=559, nrcpt=1 (queue active)
Dec 8 20:07:31 server1 postfix/qmgr[3440]: 87E34126805B: from=<apache@server1.test.com>, size=559, nrcpt=1 (queue active)
Dec 8 20:07:31 server1 postfix/qmgr[3440]: 3A53B126805A: from=<apache@server1.test.com>, size=559, nrcpt=1 (queue active)
Dec 8 20:07:31 server1 postfix/qmgr[3440]: 437C7126804F: from=<apache@server1.test.com>, size=559, nrcpt=1 (queue active)
Dec 8 20:07:34 server1 postfix/smtp[3443]: connect to ms2a.hinet.net[168.95.5.2]: Connection refused (port 25)
Dec 8 20:07:34 server1 postfix/smtp[3445]: connect to ms2a.hinet.net[168.95.5.2]: Connection refused (port 25)
Dec 8 20:07:34 server1 postfix/smtp[3444]: connect to ms2a.hinet.net[168.95.5.2]: Connection refused (port 25)
Dec 8 20:07:34 server1 postfix/smtp[3442]: connect to ms2a.hinet.net[168.95.5.2]: Connection refused (port 25)
Dec 8 20:07:34 server1 postfix/smtp[3443]: 87E34126805B: to=<bytelib@ms2.hinet.net>, relay=none, delay=1190, status=deferred (connect to ms2a.hinet.net[168.95.5.2]: Connection refused)
Dec 8 20:07:34 server1 postfix/smtp[3445]: 437C7126804F: to=<bytelib@ms2.hinet.net>, relay=none, delay=1405, status=deferred (connect to ms2a.hinet.net[168.95.5.2]: Connection refused)
Dec 8 20:07:34 server1 postfix/smtp[3444]: 3A53B126805A: to=<bytelib@ms2.hinet.net>, relay=none, delay=1194, status=deferred (connect to ms2a.hinet.net[168.95.5.2]: Connection refused)
Dec 8 20:07:34 server1 postfix/smtp[3442]: C6C391268059: to=<bytelib@ms2.hinet.net>, relay=none, delay=1232, status=deferred (connect to ms2a.hinet.net[168.95.5.2]: Connection refused)
Dec 8 20:07:49 server1 postfix/postfix-script: stopping the Postfix mail system
Dec 8 20:07:49 server1 postfix/master[3429]: terminating on signal 15
Dec 8 20:07:49 server1 postfix/postfix-script: starting the Postfix mail system
Dec 8 20:07:49 server1 postfix/master[4010]: daemon started -- version 2.1.5
Dec 8 20:09:35 server1 ipop3d[4861]: pop3 service init from 127.0.0.1
Dec 8 20:09:35 server1 ipop3d[4861]: Mailbox vulnerable - directory /var/spool/mail must have 1777 protection
Dec 8 20:09:35 server1 ipop3d[4861]: Login user=web1_pink host=server1.test.com [127.0.0.1] nmsgs=0/0
Dec 8 20:09:35 server1 ipop3d[4861]: Mailbox vulnerable - directory /var/spool/mail must have 1777 protection
Dec 8 20:09:35 server1 ipop3d[4861]: Logout user=web1_pink host=server1.test.com [127.0.0.1] nmsgs=0 ndele=0
Dec 8 20:10:06 server1 postfix/smtpd[4868]: connect from server1.test.com[127.0.0.1]
Dec 8 20:10:06 server1 postfix/smtpd[4868]: 55591126805C: client=server1.test.com[127.0.0.1]
Dec 8 20:10:06 server1 postfix/cleanup[4871]: 55591126805C: message-id=<20051208121006.55591126805C@server1.test.com>
Dec 8 20:10:06 server1 postfix/qmgr[4014]: 55591126805C: from=<pink@test.com>, size=768, nrcpt=1 (queue active)
Dec 8 20:10:06 server1 postfix/smtpd[4868]: disconnect from server1.test.com[127.0.0.1]
Dec 8 20:10:06 server1 ipop3d[4872]: pop3 service init from 127.0.0.1
Dec 8 20:10:06 server1 ipop3d[4872]: Mailbox vulnerable - directory /var/spool/mail must have 1777 protection
Dec 8 20:10:06 server1 ipop3d[4872]: Login user=web1_pink host=server1.test.com [127.0.0.1] nmsgs=0/0
Dec 8 20:10:06 server1 ipop3d[4872]: Mailbox vulnerable - directory /var/spool/mail must have 1777 protection
Dec 8 20:10:06 server1 ipop3d[4872]: Logout user=web1_pink host=server1.test.com [127.0.0.1] nmsgs=0 ndele=0
Dec 8 20:10:15 server1 ipop3d[4878]: pop3 service init from 127.0.0.1
Dec 8 20:10:15 server1 ipop3d[4878]: Mailbox vulnerable - directory /var/spool/mail must have 1777 protection
Dec 8 20:10:15 server1 ipop3d[4878]: Login user=web1_pink host=server1.test.com [127.0.0.1] nmsgs=0/0
Dec 8 20:10:15 server1 ipop3d[4878]: Mailbox vulnerable - directory /var/spool/mail must have 1777 protection
Dec 8 20:10:15 server1 ipop3d[4878]: Logout user=web1_pink host=server1.test.com [127.0.0.1] nmsgs=0 ndele=0
Dec 8 20:10:23 server1 postfix/smtp[4873]: 55591126805C: to=<bytelib@ms2.hinet.net>, relay=ms2a.hinet.net[168.95.5.2], delay=17, status=sent (250 UAA01375 Message accepted for delivery)
Dec 8 20:10:23 server1 postfix/qmgr[4014]: 55591126805C: removed

falko
8th December 2005, 17:47
Seems to be a problem with ms2a.hinet.net. I also get "Connection refused":

# telnet ms2a.hinet.net 25
Trying 168.95.5.2...
telnet: Unable to connect to remote host: Connection refused

Maybe you should contact them and ask why this happens...

rosa hsiao
9th December 2005, 03:19
Seems to be a problem with ms2a.hinet.net. I also get "Connection refused":



Maybe you should contact them and ask why this happens...

I don't think it as a problem of ms2a.hinet.net,because I can send and receive emails for bytelib@ms2.hinet.net and I can also send and receive emails to bytelib@ms2.hinet.net using web1_pink@test.com via ISPConfig's Webmail.

If I change the php mail function to another email address outside of ISPConfig Server,the result is still the same.

<?
(mail ("bytemall@mail.apol.com.tw", "PHP mail Testing....", "How are you?"));
?>

Nothing was added to maillog and there is no action at all,nor did I receive any error message on the screen.

Do I need to modify main.cf to other value as below?

mynetworks = 127.0.0.0/8
or
mynetworks = 192.168.1.0/24


mynetworks_style = subnet
or
mynetworks_style = host

falko
9th December 2005, 11:47
I really think you should contact the maintainer/administrator/ISP of ms2a.hinet.net. I guess they're having some kind of policy the restricts access to that mail server...

rosa hsiao
9th December 2005, 14:33
I really think you should contact the maintainer/administrator/ISP of ms2a.hinet.net. I guess they're having some kind of policy the restricts access to that mail server...

The problem is smtp authentication. Now I can use php mail funtion without fail. Thanks for your help.