2

I have to send email to gamil for registration of account in my website. I am using wamp ,win 7, codeigniter. And sending mail through sendmail. I have made all required changes i.e

in php.ini

; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 465
; For Win32 only.
;sendmail_from = myemail@gmail.com
sendmail_path ="C:\wamp\sendmail\sendmail.exe -t" 

And in sendmail.ini

smtp_server=smtp.gmail.com
smtp_port=465
auth_username=myemail@gmail.com
auth_password=mypassword

But it shows this error instead of sending email.

Message: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Filename: libraries/Email.php

It is still giving error on port 25 but i am using port 465. What could be the possible reason of this? What I am doing wrong? Any help.

AnFi
  • 10,493
  • 3
  • 23
  • 47
bkashaf
  • 152
  • 2
  • 12
  • you dont have to use "sendmail" program. Reset the php.ini to previous and simply use codeigniter to send the mail; follow instructions in http://stackoverflow.com/a/1622996. No extra config on localhost server required if you're using codeigniter (codeigniter already has an inbuilt php mailer library). –  Jul 28 '13 at 17:33

2 Answers2

1

I think you have to restart your server.

edit I found this thread with soulution:

Add the following code to the top of your email script if your mail script continues to fail.


// Please specify your Mail Server - Example: mail.yourdomain.com.
ini_set("SMTP","mail.YourDomain.com");

// Please specify an SMTP Number 25 and 8889 are valid SMTP Ports.
ini_set("smtp_port","25");

// Please specify the return address to use
ini_set('sendmail_from', 'ValidEmailAccount@YourDomain.com');
Daniel Kmak
  • 18,164
  • 7
  • 66
  • 89
1

I just made those changes in C:\wamp\bin\apache\apache2.2.22\bin\php.ini instead of C:\wamp\bin\php\php.ini. And it works :)

bkashaf
  • 152
  • 2
  • 12