2

when i tried sending a mail using php mail function at localhost, i get the following error....what could be the issue....i even tried changing php.ini file and gave smtp host value my service provider value and it still dint work

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

Sanjai Palliyil
  • 599
  • 2
  • 11
  • 27

3 Answers3

2

For me, adding the following code in the calling file did the trick

// xampp code fix      
ini_set( 'sendmail_from', "myself@my.com" ); \\ My usual e-mail address
ini_set( 'SMTP', "mail.bigpond.com" );  \\ My usual sender
ini_set( 'smtp_port', 25 );
D3F4ULT
  • 926
  • 1
  • 12
  • 20
Rhys
  • 975
  • 1
  • 6
  • 12
  • Notice: Use of undefined constant sendmail_from - assumed 'sendmail_from' in C:\wamp\www\sample\cms\download.php on line 101 Notice: Use of undefined constant SMTP - assumed 'SMTP' in C:\wamp\www\sample\cms\download.php on line 102 Notice: Use of undefined constant smtp_port - assumed 'smtp_port' in C:\wamp\www\sample\cms\download.php on line 103 Warning: mail() [function.mail]: SMTP server response: 550 Message rejected because (ITF152) [122.172.120.168] is blacklisted. in C:\wamp\www\sample\cms\download.php on line 109 – Sanjai Palliyil Sep 03 '10 at 05:35
  • Those settings work with XAMPP using mail.php and pear. I understand wamp has no mail function?? – Rhys Sep 03 '10 at 06:57
  • You said .i got the error my ip is blacklisted - use your usual email sender as the SMTP – Rhys Sep 03 '10 at 07:29
  • @rhys How do you find out your send? I am on windows but want to send from my linux server that has no problem sending mail... – sjw0525 May 17 '18 at 15:14
1

I have used Fake Sendmail to successfully send emails from my localhost running WAMP.

Try following the instructions here to get it up and running.

tchow002
  • 1,068
  • 6
  • 8
0

Well do you have a mailserver configured on localhost? Otherwise to use mail you will probably have to use you internets provider smtp servers instead of localhost to connect.

Iznogood
  • 12,447
  • 3
  • 26
  • 44