-2

I got a contact form from google and try to use the php mai() function. this the error I get: ( ! ) Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. y15sm903941wro.68 - gsmtp in C:\wamp64\www\a.php on line 30

this the a.php file:enter image description here

and this is the configuration i used in my php.ini file:

; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com

; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.``
; http://php.net/sendmail-from
sendmail_from ="yo.thiam@gmail.com"

please help me

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • 1
    Welcome to Stack Overflow. Please don't post code as images - instead, paste the code necessary for your [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) into the body of your question to make it easier for future visitors to the question. See also: [Why not upload images of code on SO when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question) – esqew Apr 10 '20 at 03:15
  • I didnt get a solution from that post – Younouss Thiam Apr 10 '20 at 03:17

1 Answers1

0

Your mail host(Gmail) requires emails be sent using SMTP over TLS(transport-layer security, which encrypts the data in transit). PHP's built-in mail function does not support TLS by default and is trying to use plain SMTP. You will need to use a local mail relay that can handle outbound TLS or use a different library(like PHPMailer).

akenion
  • 805
  • 1
  • 5
  • 9
  • Which local mail relay can i use? – Younouss Thiam Apr 10 '20 at 03:25
  • You could run something like [postfix](http://www.postfix.org/). You would run that on your web server and point your mail command to that(without using TLS) and have it forward emails through your Gmail account(using TLS). – akenion Apr 10 '20 at 03:33
  • I am trying to use fake send mail bit it seems it is not running from sendmailpath – Younouss Thiam Apr 10 '20 at 03:52
  • I'm not familiar with fake sendmail, so I don't have a good answer on that piece. That may warrant a separate question. – akenion Apr 10 '20 at 03:57