Problem in sending email from localhost

Problem in sending email from localhost

am 02.02.2011 17:37:53 von Niamathullah Sharief

--0023547c895b4494da049b4f45e9
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I am trying to send mail from my localhost but i am getting the below
error
""Warning: mail() [function.mail]: Failed to connect to mailserver at
"localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
or use ini_set() in F:\test\xampp\htdocs\sendmail.php on line 42'"

I am using xampp server. Can anyone please tell me what is the error

My "php.ini" code is
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = xxxxxxxx@gmail.com

; For Unix only. You may supply arguments as well (default:
"sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as
extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include
uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line
#, to address and headers
;mail.log = "F:\test\xampp\apache\logs\php_mail.log"

--0023547c895b4494da049b4f45e9--

Re: Problem in sending email from localhost

am 02.02.2011 18:08:18 von Richard Quadling

On 2 February 2011 16:37, Niamathullah Sharief wrote:
> SMTP = smtp.gmail.com

You are trying to send mail via Google Mail, not your own localhost SMTP engine.

Is that your intention?

--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem in sending email from localhost

am 02.02.2011 18:26:47 von Ferenc Kovacs

--00163630fd8721629e049b4ff4ad
Content-Type: text/plain; charset=UTF-8

On Wed, Feb 2, 2011 at 5:37 PM, Niamathullah Sharief wrote:

> Hi,
>
> I am trying to send mail from my localhost but i am getting the below
> error
> ""Warning: mail() [function.mail]: Failed to connect to mailserver at
> "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
> or use ini_set() in F:\test\xampp\htdocs\sendmail.php on line 42'"
>
> I am using xampp server. Can anyone please tell me what is the error
>
> My "php.ini" code is
> [mail function]
> ; For Win32 only.
> ; http://php.net/smtp
> SMTP = smtp.gmail.com
> ; http://php.net/smtp-port
> smtp_port = 587
>
> ; For Win32 only.
> ; http://php.net/sendmail-from
> ;sendmail_from = xxxxxxxx@gmail.com
>
> ; For Unix only. You may supply arguments as well (default:
> "sendmail -t -i").
> ; http://php.net/sendmail-path
> ;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t"
>
> ; Force the addition of the specified parameters to be passed as
> extra parameters
> ; to the sendmail binary. These parameters will always replace the value of
> ; the 5th parameter to mail(), even in safe mode.
> ;mail.force_extra_parameters =
>
> ; Add X-PHP-Originating-Script: that will include
> uid of the script followed by the filename
> mail.add_x_header = Off
>
> ; Log all mail() calls including the full path of the script, line
> #, to address and headers
> ;mail.log = "F:\test\xampp\apache\logs\php_mail.log"
>

guessing from the error message, it seems that your SMTP and smtp_port
configuration is ignored(the error mentions localhost and port 25, which is
the default settings, that should be smtp.gmail.com and 587 by your config),
could you check, that you are editing the correct php.ini file?

Tyrael

--00163630fd8721629e049b4ff4ad--

Re: Problem in sending email from localhost

am 03.02.2011 06:05:38 von Niamathullah Sharief

--000e0cd4057c6a3665049b59b759
Content-Type: text/plain; charset=ISO-8859-1

I did that too. but still i got the same error.

On Wed, Feb 2, 2011 at 10:56 PM, Ferenc Kovacs wrote:

>
> On Wed, Feb 2, 2011 at 5:37 PM, Niamathullah Sharief wrote:
>
>> Hi,
>>
>> I am trying to send mail from my localhost but i am getting the below
>> error
>> ""Warning: mail() [function.mail]: Failed to connect to mailserver at
>> "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
>> or use ini_set() in F:\test\xampp\htdocs\sendmail.php on line 42'"
>>
>> I am using xampp server. Can anyone please tell me what is the error
>>
>> My "php.ini" code is
>> [mail function]
>> ; For Win32 only.
>> ; http://php.net/smtp
>> SMTP = smtp.gmail.com
>> ; http://php.net/smtp-port
>> smtp_port = 587
>>
>> ; For Win32 only.
>> ; http://php.net/sendmail-from
>> ;sendmail_from = xxxxxxxx@gmail.com
>>
>> ; For Unix only. You may supply arguments as well (default:
>> "sendmail -t -i").
>> ; http://php.net/sendmail-path
>> ;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t"
>>
>> ; Force the addition of the specified parameters to be passed as
>> extra parameters
>> ; to the sendmail binary. These parameters will always replace the value
>> of
>> ; the 5th parameter to mail(), even in safe mode.
>> ;mail.force_extra_parameters =
>>
>> ; Add X-PHP-Originating-Script: that will include
>> uid of the script followed by the filename
>> mail.add_x_header = Off
>>
>> ; Log all mail() calls including the full path of the script, line
>> #, to address and headers
>> ;mail.log = "F:\test\xampp\apache\logs\php_mail.log"
>>
>
> guessing from the error message, it seems that your SMTP and smtp_port
> configuration is ignored(the error mentions localhost and port 25, which is
> the default settings, that should be smtp.gmail.com and 587 by your
> config), could you check, that you are editing the correct php.ini file?
>
> Tyrael
>

--000e0cd4057c6a3665049b59b759--

Re: Problem in sending email from localhost

am 03.02.2011 06:13:52 von Niel Archer

> Hi,
>
> I am trying to send mail from my localhost but i am getting the below
> error
> ""Warning: mail() [function.mail]: Failed to connect to mailserver at
> "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
> or use ini_set() in F:\test\xampp\htdocs\sendmail.php on line 42'"
>
> I am using xampp server. Can anyone please tell me what is the error


Only Server versions have an MTA available, so if you are using XP,
Vista, or 7; for example, then there is no MTA listening on localhost,
hence the error.

See the documentation for mail(), in particular the notes for Windows
specifics, at:
http://www.php.net/manual/en/function.mail.php

However, this is only relevant as your .ini settings seem to be ignored.
Make sure this is in fact the ini file being used. use phpinfo() and
check the used ini path is the same as the one you think should be used.

> My "php.ini" code is
> [mail function]
> ; For Win32 only.
> ; http://php.net/smtp
> SMTP = smtp.gmail.com
> ; http://php.net/smtp-port
> smtp_port = 587

I'm not sure, but I think you may be barking up the wrong tree here. I
don't know how you can use mail() to authenticate with gmail's smtp
server over TLS, as mail() does not have parameters for username and
password. You might be better trying the PEAR::Mail package


> ; For Win32 only.
> ; http://php.net/sendmail-from
> ;sendmail_from = xxxxxxxx@gmail.com
>
> ; For Unix only. You may supply arguments as well (default:
> "sendmail -t -i").
> ; http://php.net/sendmail-path
> ;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t"
>
> ; Force the addition of the specified parameters to be passed as
> extra parameters
> ; to the sendmail binary. These parameters will always replace the value of
> ; the 5th parameter to mail(), even in safe mode.
> ;mail.force_extra_parameters =
>
> ; Add X-PHP-Originating-Script: that will include
> uid of the script followed by the filename
> mail.add_x_header = Off
>
> ; Log all mail() calls including the full path of the script, line
> #, to address and headers
> ;mail.log = "F:\test\xampp\apache\logs\php_mail.log"

--
Niel Archer



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem in sending email from localhost

am 03.02.2011 10:17:54 von Chuck Reeves

--000e0cd4d8f49d5567049b5d3de9
Content-Type: text/plain; charset=UTF-8

Check with your isp to see if they block smtp traffic. Most of the tme they
require you to use there smtp in an effort to thwart spammers

Thank You
Chuck Reeves
www.manchuck.com



On Thu, Feb 3, 2011 at 12:13 AM, Niel Archer wrote:

> > Hi,
> >
> > I am trying to send mail from my localhost but i am getting the below
> > error
> > ""Warning: mail() [function.mail]: Failed to connect to mailserver at
> > "localhost" port 25, verify your "SMTP" and "smtp_port" setting in
> php.ini
> > or use ini_set() in F:\test\xampp\htdocs\sendmail.php on line 42'"
> >
> > I am using xampp server. Can anyone please tell me what is the error
>
>
> Only Server versions have an MTA available, so if you are using XP,
> Vista, or 7; for example, then there is no MTA listening on localhost,
> hence the error.
>
> See the documentation for mail(), in particular the notes for Windows
> specifics, at:
> http://www.php.net/manual/en/function.mail.php
>
> However, this is only relevant as your .ini settings seem to be ignored.
> Make sure this is in fact the ini file being used. use phpinfo() and
> check the used ini path is the same as the one you think should be used.
>
> > My "php.ini" code is
> > [mail function]
> > ; For Win32 only.
> > ; http://php.net/smtp
> > SMTP = smtp.gmail.com
> > ; http://php.net/smtp-port
> > smtp_port = 587
>
> I'm not sure, but I think you may be barking up the wrong tree here. I
> don't know how you can use mail() to authenticate with gmail's smtp
> server over TLS, as mail() does not have parameters for username and
> password. You might be better trying the PEAR::Mail package
>
>
> > ; For Win32 only.
> > ; http://php.net/sendmail-from
> > ;sendmail_from = xxxxxxxx@gmail.com
> >
> > ; For Unix only. You may supply arguments as well (default:
> > "sendmail -t -i").
> > ; http://php.net/sendmail-path
> > ;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t"
> >
> > ; Force the addition of the specified parameters to be passed as
> > extra parameters
> > ; to the sendmail binary. These parameters will always replace the value
> of
> > ; the 5th parameter to mail(), even in safe mode.
> > ;mail.force_extra_parameters =
> >
> > ; Add X-PHP-Originating-Script: that will include
> > uid of the script followed by the filename
> > mail.add_x_header = Off
> >
> > ; Log all mail() calls including the full path of the script, line
> > #, to address and headers
> > ;mail.log = "F:\test\xampp\apache\logs\php_mail.log"
>
> --
> Niel Archer
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--000e0cd4d8f49d5567049b5d3de9--

RE: Problem in sending email from localhost

am 03.02.2011 14:40:33 von Tommy Pham

1) Which SMTP server are you trying to use? On your local system? Or
smtp.gmail.com?
2a) If local system, which are are using? MS' SMTP or 3rd party like hmail?
Are you sure the server is configured properly and that the service is
running? Run this in command prompt:

netstat -ano | more

You should see something like this:

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:25 0.0.0.0:0 LISTENING 2744

If not, then that's your problem. You don't have a SMTP server/service
running. Notice that last number. If you're running MS' SMTP, in the
taskmanager, it should match up with the process inetinfo.exe. If you're
using 3rd party, it should match up with their executable. In the case of
hmail, it should be hmailserver.exe.

2b) If you're using gmail's, from the same system that your PHP code
resides on, are you able able to connect to the gmail's SMTP using Outlook
Express to check the validity of the account and no misconfigured
firewalls/routers (both hardware and software)?

3) Run phpinfo(); and check "Loaded Configuration File" to ensure that
it's loading the right php.ini file. Sometimes you think it loads the right
one but it doesn't. Don't assume. Verify. Then either scroll down or
CTRL+F and look for 'SMTP'. It should be as you configured it, that is if
it loads the php.ini file from the correct location.

FYI, I suggest you stay away from non official packaged distributions as
those tend to put things in places you'll least expect. Getting the
official distribution is strongly advised. It may take you longer to
understand and get things going. But in the long run, that knowledge can
further aid you as you can fine tune the configurations to your specific
needs and also helps with the troubleshooting of various errors like the one
you're having now. Furthermore, should the need arise when you have to
upgrade for any reason, you don't have to rely on non official distribution
as sometimes those won't be updated quickly enough, especially when there's
a security bug fix release.

Regards,
Tommy


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem in sending email from localhost

am 05.02.2011 09:19:55 von Niamathullah Sharief

--90e6ba4fbe2ee8b2d4049b84a981
Content-Type: text/plain; charset=ISO-8859-1

Yes i am using local system, So now i changed as "localhost" instead of
smtp.gmail.com. But still i am getting the below error

*Warning*: mail() [function.mail ]: SMTP
> server response: 550-5.7.1 [122.163.25.135] The IP you're using to send mail
> is not authorized to 550-5.7.1 send email directly to our servers. Please
> use the SMTP relay at your 550-5.7.1 service provider instead. Learn more at
> 550 5.7.1 http://mail.google.com/support/bin/answer.py?answer=10336he4 1si4092182ibb.18 in
> *F:\test\xampp\htdocs\sendmail.php* on line*44*


I checked "phpinfo()" also. Its using the correct "php.ini" config file.

I checked this "etstat -ano | moren" command also. Its working fine. So it
shows that my server is working fine. Now i dont know what will be the
error. Anyway i will post the modified new php.ini mail function part.

*[mail function]*
*; For Win32 only.*
*; http://php.net/smtp*
*SMTP = localhost*
*; http://php.net/smtp-port*
*smtp_port = 25*
*
*
*; For Win32 only.*
*; http://php.net/sendmail-from*
*sendmail_from = xxxxxxxxxx@gmail.com*
*
*
*
*
*; For Unix only. You may supply arguments as well (default: "sendmail -t
-i").*
*; http://php.net/sendmail-path*
*;sendmail_path = "\"F:\test\xampp\sendmail\sendmail.exe\" -t"*
*
*
*; Force the addition of the specified parameters to be passed as extra
parameters*
*; to the sendmail binary. These parameters will always replace the value of
*
*; the 5th parameter to mail(), even in safe mode.*
*;mail.force_extra_parameters =*
*
*
*; Add X-PHP-Originating-Script: that will include uid of the script
followed by the filename*
*mail.add_x_header = Off*
*
*
*; Log all mail() calls including the full path of the script, line #, to
address and headers*
*;mail.log = "F:\test\xampp\apache\logs\php_mail.log" *
* *
*
*
Now i dont know what is wrong and why my message is not going....Please help
me

On Thu, Feb 3, 2011 at 7:10 PM, Tommy Pham wrote:

> 1) Which SMTP server are you trying to use? On your local system? Or
> smtp.gmail.com?
> 2a) If local system, which are are using? MS' SMTP or 3rd party like
> hmail?
> Are you sure the server is configured properly and that the service is
> running? Run this in command prompt:
>
> etstat -ano | moren
>
> You should see something like this:
>
> Proto Local Address Foreign Address State PID
> TCP 0.0.0.0:25 0.0.0.0:0 LISTENING 2744
>
> If not, then that's your problem. You don't have a SMTP server/service
> running. Notice that last number. If you're running MS' SMTP, in the
> taskmanager, it should match up with the process inetinfo.exe. If you're
> using 3rd party, it should match up with their executable. In the case of
> hmail, it should be hmailserver.exe.
>
> 2b) If you're using gmail's, from the same system that your PHP code
> resides on, are you able able to connect to the gmail's SMTP using Outlook
> Express to check the validity of the account and no misconfigured
> firewalls/routers (both hardware and software)?
>
> 3) Run phpinfo(); and check "Loaded Configuration File" to ensure that
> it's loading the right php.ini file. Sometimes you think it loads the
> right
> one but it doesn't. Don't assume. Verify. Then either scroll down or
> CTRL+F and look for 'SMTP'. It should be as you configured it, that is if
> it loads the php.ini file from the correct location.
>
> FYI, I suggest you stay away from non official packaged distributions as
> those tend to put things in places you'll least expect. Getting the
> official distribution is strongly advised. It may take you longer to
> understand and get things going. But in the long run, that knowledge can
> further aid you as you can fine tune the configurations to your specific
> needs and also helps with the troubleshooting of various errors like the
> one
> you're having now. Furthermore, should the need arise when you have to
> upgrade for any reason, you don't have to rely on non official distribution
> as sometimes those won't be updated quickly enough, especially when there's
> a security bug fix release.
>
> Regards,
> Tommy
>
>

--90e6ba4fbe2ee8b2d4049b84a981--

Re: Problem in sending email from localhost

am 05.02.2011 11:29:41 von Tommy Pham

On Sat, Feb 5, 2011 at 12:19 AM, Niamathullah Sharief wr=
ote:
> Yes i am using local system, So now i changed as "localhost" instead of
> smtp.gmail.com. But still i am getting the below error
>>
>> Warning: mail() [function.mail]: SMTP server response: 550-5.7.1
>> [122.163.25.135] The IP you're using to send mail is not authorized to
>> 550-5.7.1 send email directly to our servers. Please use the SMTP relay =
at
>> your 550-5.7.1 service provider instead. Learn more at 550 5.7.1
>> http://mail.google.com/support/bin/answer.py?answer=3D10336
>> he41si4092182ibb.18 in F:\test\xampp\htdocs\sendmail.php on li=
ne44
>



The problem you're having now is beyond the scope of this list. See
[1], [2], & [3].

Good luck,
Tommy

[1] http://www.google.com/search?q=3Dhow+to+setup+smtp+server
[2] http://www.google.com/search?q=3Dmx+record
[3] http://www.google.com/search?q=3Ddomain+keys

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem in sending email from localhost

am 05.02.2011 11:31:31 von Tommy Pham

On Sat, Feb 5, 2011 at 2:29 AM, Tommy Pham wrote:
> On Sat, Feb 5, 2011 at 12:19 AM, Niamathullah Sharief =
wrote:
>> Yes i am using local system, So now i changed as "localhost" instead of
>> smtp.gmail.com. But still i am getting the below error
>>>
>>> Warning: mail() [function.mail]: SMTP server response: 550-5.7.1
>>> [122.163.25.135] The IP you're using to send mail is not authorized to
>>> 550-5.7.1 send email directly to our servers. Please use the SMTP relay=
at
>>> your 550-5.7.1 service provider instead. Learn more at 550 5.7.1
>>> http://mail.google.com/support/bin/answer.py?answer=3D10336
>>> he41si4092182ibb.18 in F:\test\xampp\htdocs\sendmail.php on l=
ine44
>>
>
>
>
> The problem you're having now is beyond the scope of this list.  See
> [1], [2], & [3].
>
> Good luck,
> Tommy
>
> [1] http://www.google.com/search?q=3Dhow+to+setup+smtp+server
> [2] http://www.google.com/search?q=3Dmx+record
> [3] http://www.google.com/search?q=3Ddomain+keys
>

BTW, did you click on that google link? It would tell you of a
possible solution to your problem.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem in sending email from localhost

am 05.02.2011 12:05:10 von Niamathullah Sharief

--00235448f283ed3402049b86f885
Content-Type: text/plain; charset=ISO-8859-1

Hi guys. Wonder happens. I got one mail from my localhost. But i dont know
in which attempt i got that mail. Because in each and every try I was
changing my config file.

Now i dont know in which attempt it works...


On Sat, Feb 5, 2011 at 4:01 PM, Tommy Pham wrote:

> On Sat, Feb 5, 2011 at 2:29 AM, Tommy Pham wrote:
> > On Sat, Feb 5, 2011 at 12:19 AM, Niamathullah Sharief
> wrote:
> >> Yes i am using local system, So now i changed as "localhost" instead of
> >> smtp.gmail.com. But still i am getting the below error
> >>>
> >>> Warning: mail() [function.mail]: SMTP server response: 550-5.7.1
> >>> [122.163.25.135] The IP you're using to send mail is not authorized to
> >>> 550-5.7.1 send email directly to our servers. Please use the SMTP relay
> at
> >>> your 550-5.7.1 service provider instead. Learn more at 550 5.7.1
> >>> http://mail.google.com/support/bin/answer.py?answer=10336
> >>> he41si4092182ibb.18 in F:\test\xampp\htdocs\sendmail.php on line44
> >>
> >
> >
> >
> > The problem you're having now is beyond the scope of this list. See
> > [1], [2], & [3].
> >
> > Good luck,
> > Tommy
> >
> > [1] http://www.google.com/search?q=how+to+setup+smtp+server
> > [2] http://www.google.com/search?q=mx+record
> > [3] http://www.google.com/search?q=domain+keys
> >
>
> BTW, did you click on that google link? It would tell you of a
> possible solution to your problem.
>

--00235448f283ed3402049b86f885--