0

I would like to send this email.

I have seen configuration but not sure what to do or make any heads or tails out of them. The mail would be sent from my PC right now.

Error I get is - Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\send.php on line 165.

http://www.cyberciti.biz/tips/howto-php-send-email-via-smtp-authentication.html http://forums.devshed.com/mail-server-help-111/how-to-set-up-php-ini-to-send-mail-from-106329.html

Looked on these two sites from google search but don't acutally understand it. Can some help me please.

Will_S
  • 71
  • 1
  • 11
  • I cant send anything. The error I get is - Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\send.php on line 165. – Will_S Feb 01 '12 at 00:23
  • Do you have a mail server installed? – webbiedave Feb 01 '12 at 00:23
  • I havent installed anything. Im learning bit by bit, all I need is mail server? – Will_S Feb 01 '12 at 00:24
  • `$to = will@hotmail.com;`?! Where are your quotes young man? – Ben D Feb 01 '12 at 00:26

2 Answers2

3

You're trying to send mail from your localhost (Your PC) It's not setup to send mail. Move the script to a production server and it will work

Paul Dessert
  • 6,363
  • 8
  • 47
  • 74
  • So once I have moved my code to a working server, everything should be sending? Is that what your saying? Because later when my code is complete, it will be moved but it is working in progress right now. – Will_S Feb 01 '12 at 00:26
  • Yep, it should work just fine. Your localhost won't always work exactly as a real production server. This is one of those examples – Paul Dessert Feb 01 '12 at 00:27
  • Thank you very much. If I wanted to test it, what would I need to install to make it work? – Will_S Feb 01 '12 at 00:28
  • Give this a shot. I haven't tried this tutorial, but after glancing at it, it seems right. http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html – Paul Dessert Feb 01 '12 at 00:30
1

You don't have a mail server installed. You have a few options:

  1. Install a mail server such as Postfix or sendmail
  2. Connect to an existing SMTP server, for example through Gmail. (See: Send email using the GMail SMTP server from a PHP page)
Community
  • 1
  • 1
jli
  • 6,523
  • 2
  • 29
  • 37