SAJITHKUMAR G S wrote:I am trying to create a email application using php. I am getting my code working without any error,but the mail is not being sent. when i check the error log 5.7.0 Must issue a STARTTLS command first. 20sm6691869pzk.11 ... smtp_server= smtp.gmail.com
The Gmail server likely refuses to be used as a relay rather than for submission services. Are you sending the mail to port 25 rather than 587? Also, Gmail's SMTP server will require authentication, and only accepts it after an STARTTLS has been issued to enter encrypted mode. I don't know how to configure this, but that's what you would need when using Gmail to submit your messages.
On the other hand: Since you are running your own SMTP server, why rely on Gmail? Unless your provider blocks port 25, you could just use its default configuration to relay the messages directly to the respective MX hosts registered in DNS, thus foregoing the need of using an "official" server. This does increase your spam score slightly though as many providers employ a service to identify servers used which don't match the provider of the e-mail address from which the message was sent.