Page 2 of 2

Re: Problem in sending email from localhost

Posted: Wed Feb 02, 2011 1:46 am
by josh
Are you trolling?
josh wrote: Use localhost, not mail.google.com
I said that and you reply, "which host should I use, I am using google" :roll:

Either this or you'll need to authenticate with your gmail details, as like I said Google requires authenticated gmail users as the 'mail from' address.

Re: Problem in sending email from localhost

Posted: Wed Feb 02, 2011 10:12 am
by shariefbe
sorry i am novice. please dont mistake me and see my php.ini

Code: Select all


[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"
should i use any extra thing to send mail from my localhost. i mean authentication?

Re: Problem in sending email from localhost

Posted: Thu Feb 03, 2011 4:31 pm
by josh
Stop using smtp.google.com and use localhost.

Re: Problem in sending email from localhost

Posted: Fri Feb 04, 2011 5:46 am
by shariefbe
Yes i now i understood. I used localhost and still i got that error. So i did "telnel localhost 25" in cmd prompt. it tells "connecting to localhost.....Could not open connection to the host, on port 25: connect failed"
Don't know what is wrong. I already using xampp. All are working fine. I can visit my website by localhost. so it shows my server is working. But it is not working when i use telnet?

Re: Problem in sending email from localhost

Posted: Fri Feb 04, 2011 8:36 am
by josh
shariefbe wrote:Could not open connection to the host, on port 25: connect failed"
This means no program is listening on that port. This is 100% evidence that you do not have a MTA (mail transfer agent) running.

In my experience setting up mail servers on windows is a pain, on linux its much easier. You could try this perl script which will run on windows, it emulates an SMTP server on localhost and just sends the emails to a .txt file on disk. http://www.lastcraft.com/fakemail.php

Re: Problem in sending email from localhost

Posted: Fri Feb 04, 2011 10:33 am
by John Cartwright
josh wrote:
shariefbe wrote:Could not open connection to the host, on port 25: connect failed"
This means no program is listening on that port. This is 100% evidence that you do not have a MTA (mail transfer agent) running.

In my experience setting up mail servers on windows is a pain, on linux its much easier. You could try this perl script which will run on windows, it emulates an SMTP server on localhost and just sends the emails to a .txt file on disk. http://www.lastcraft.com/fakemail.php
+1

Otherwise, use your ISP's mailing server.

Re: Problem in sending email from localhost

Posted: Fri Feb 04, 2011 11:05 am
by josh
The ISP's mail server probably uses outgoing authentication too. If you want to use authentication like your ISP, or gmail... you'll need something above & beyond the mail() function. Look into phpmailer or swift mailer.

Re: Problem in sending email from localhost

Posted: Sat Feb 05, 2011 5:09 am
by shariefbe
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...