2

This is my sendmail.ini file:

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=mymail@gmail.com
auth_password=****************
force_sender=mymail@gmail.com

After sending an email my debug.log file looks like this:

13/05/27 20:46:36 ** Connecting to smtp.gmail.com:25
13/05/27 20:46:40 ** Connected.
13/05/27 20:46:42 << 220 mx.google.com ESMTP dr6sm30900757pac.11 - gsmtp<EOL>
13/05/27 20:46:42 >> EHLO ANKON-PC<EOL>
13/05/27 20:46:44 << 250-mx.google.com at your service, [202.134.13.131] 

<EOL>250-SIZE   
<EOL>250-8BITMIME<EOL>250-STARTTLS<EOL>250-ENHANCEDSTATUSCODES<EOL>250 ...<EOL>

13/05/27 20:46:44 ** Authenticating as mymail@gmail.com
13/05/27 20:46:44 >> STARTTLS<EOL>
13/05/27 20:46:45 << 220 2.0.0 Ready to start TLS<EOL>
13/05/27 20:46:45 >> QUIT<EOL>
13/05/27 20:46:46 <<  5  1Q£q×:Y

ý‰KÿhÓ&ïË‹­¶ð3Àm¼`      ÿ   #  E A > „0‚€0‚é 

13/05/27 20:46:47 <<  F
13/05/27 20:46:47 ** Disconnected.
13/05/27 20:46:47 ** Disconnecting from smtp.gmail.com:25
13/05/27 20:46:47 ** Disconnected.
13/05/27 20:46:47 ** Disconnected.
13/05/27 20:46:47 ** Connection Closed Gracefully.

But actually this things worked for first time but after that it doesn't work. I use xampp in my pc. So what should I do to send an email. Please someone tell me.

ankon
  • 21
  • 1
  • 1
  • 3
  • You are trying to send to gmail.com through your own sendmail, php is connecting to your sendmail (localhost)? Did you look here: http://stackoverflow.com/questions/4948687/xampp-sendmail-using-gmail-account – Axel Amthor May 27 '13 at 15:29
  • 1
    You can't just use gmail smtp, set up your owm mailserver using Exim – edwardmp May 27 '13 at 15:29
  • I tried this and it works for first time but later it doesn't work @AxelAmthor – ankon May 27 '13 at 16:25
  • now there is a error that is "SSL is not available on this server." How can i solve it? – ankon May 28 '13 at 07:51
  • @edwardmp - some mailer classes, such as phpMailer do actually allow you to use gmail smtp. – Spudley May 28 '13 at 10:55

4 Answers4

1

You cannot simply specify an external mail server like gmail in this way and expect it to work, even with the correct credentials. You simply won't get this working with the PHP mail() function.

My suggestion is to abandon the mail() function entirely -- it has a lot of shortcomings, of which this is just one.

Instead, download the phpMailer library. This is a PHP class that makes sending mail via PHP much much simpler.

Specifically in your case, it has the ability to send via gMail built-in, meaning that you don't need to mess around with your server config or set up your own mail relay or anything like that; just follow this example to get phpMailer working with your gMail account, and you should be up and running really quickly.

Hope that helps.

Spudley
  • 166,037
  • 39
  • 233
  • 307
1

Try: smtp_ssl=none

; SMTPS (SSL) support

; auto = use SSL for port 465, otherwise try to use TLS

; ssl = alway use SSL

; tls = always use TLS

; none = never try to use SSL

naik
  • 31
  • 2
0

You need to configure your SMTP server / sendmail as full relay host. Since sendmail is quite old and very very very complex to configure, you should consider Exim (as @edwardmp suggests) or postfix.

Actually, your install is missing parts like SSL and going through this would also mean you need to generate server certificates, a cert authority etc etc. and probably other parts are missing as well.

Question is, whether there is a relay host somewhere on the net and reachable and whether you may use that (how is your company sending emails?)

Axel Amthor
  • 10,980
  • 1
  • 25
  • 44
0
  1. Right click on sendmail.exe
  2. property
  3. compatibility
  4. change setting for all user
  5. tick on comptatibility mode.
sth
  • 222,467
  • 53
  • 283
  • 367