Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Setting Problem

Status
Not open for further replies.

rejoice

MIS
Jun 5, 2002
42
MY
My computer is connected within a workgroup and one of the computer serve as a proxy for us to send/receive our pop3 mail. It work fine with my outlook express. But, when I tried to put the setting in my php.ini, it does not work.

Can anyone help me?

By the way, I am using Win98 with Apache (PHPTriad).

php.ini
=======
[mail function]
SMTP = "10.8.0.1" ;for win32 only
smtp_port = "2550"
sendmail_from = "abc#smtp.tm.net.my" ;for win32 only
;sendmail_path =

Many thanks.
 
Is that port correct? 2550 is an unusual port for SMTP -- 25 is the norm.

Test the settings to ensure they work. From the machine running PHP, use telnet to open a connection to the mail machine on the port you've specified.

Your MTA could also be barfing on the sendmail_from address you've given it. You've supplied username#domainname -- username@domainname is the norm. ______________________________________________________________________
TANSTAAFL!
 
2550 is correct for outgoing mail. 1110 is for incoming mail. I used them in my outlook express setting, because the proxy computer require it.

 
In any regard, can you telnet from your PHP machine to the mail server on that port and get a connection? ______________________________________________________________________
TANSTAAFL!
 
telnet 10.8.0.1 2550 work fine. It connected to the proxy computer with the smtp port.

 
Let's take a look at this line from your php.ini:

sendmail_from = "abc#smtp.tm.net.my" ;for win32 only


Is this correct? Should it not read, "abc@stmp.tm.net.my"? ______________________________________________________________________
TANSTAAFL!
 
Before change to this I have tried the following setting:

SMTP = smtp.tm.net.my
sendmail_from = my_name@tm.net.my

and my PHP coding was:

<?
mail(&quot;joecool@example.com&quot;, &quot;My Subject&quot;, &quot;Line 1\nLine 2\nLine 3&quot;);
?>

But, the error message was:

Warning: Failed to connect to mailserver, verify your &quot;SMTP&quot; setting in php.ini in C:\Program Files\Apache Group\Apache2\htdocs\TMP23g015uq3k.php on line 2

Therefore, I suspect the settings should be substitue/add the proxy server address as well.

SMTP = 10.8.0.1 //proxy server address
sendmail_from = my_name#smtp.tm.net.my
//my login name cum stmp server address.

Error also,

Warning: Failed to connect to mailserver, verify your &quot;SMTP&quot; setting in php.ini in C:\Program Files\Apache Group\Apache2\htdocs\TMP27tl45uq98.php on line 2

So, what should I do with the PHP settings?

SOS!!!
 
If you are running PHP as a web server plugin, you are restarting the web server after each time editing php.ini, right?


Here's what I do to test SMTP settings:

1. From the machine were PHP runs, use telnet to connect to the SMTP server. danielhozac gave you instructions on how to do that earlier in this thread.

2. Once you are connected, try to send an email by hand. Assuming that I want to send email from me@mydomain.com to you@yourdomain.com, type the following commands in, including the triangle brackets: (You'll want to make sure that local echo is turned on in telnet)

mail from: <me@mydomain.com> [enter]
>>Server resonds with something beginning with &quot;250&quot;
rcpt to: <you@yourdomain.com>[enter]
>>Server again responds with some string beginning with &quot;250&quot;
data[enter]
>>Server responds with some string beginning with &quot;354&quot;
Subject: test[enter]
To: you <you@yourdomain.com>[enter]
From: me <me@mydomain.com>[enter]
[enter]
test[enter]
.[enter]
>>Server responds with some string beginning with &quot;250&quot;
quit[enter]


If all goes well, this will send and email through your system. Whatever works while doing through telnet will work in PHP's settings. ______________________________________________________________________
TANSTAAFL!
 
Thanks you sleipnir214 for your clear instruction. I have seen this in the book of Professional PHP4 by Wrox. But what puzzle me was the computer I am using is not a web hosting server, but just a client PC. Normally I test my PHP using localhost.

Do you mean that I should upload my PHP code to my hosting server in order to make mail() run?

 
No. What I'm saying is that I recommend that you test communication with the mail server from the machine that is currently running PHP. ______________________________________________________________________
TANSTAAFL!
 
Can you please explain to me how should I telnet to the mail server?

For your information, my computer installed with Apache, PHP4 and MySQL. This computer only used for testing locally. Once the php is ok, then I will upload to my webhosting server. My computer do not have domain name and fix IP address. Does my Apache have mail server?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top