Submit Gmail from php form

I have a project to set up an anonymous feedback form on our website. I would like to go for it with php

The general idea is that I will have a password field (give our staff) a feedback field and a button

I saw this piece of code

<?php
$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
 } else {
  echo("<p>Message delivery failed...</p>");
 }
?>

But I’m sure that my systems with limited understanding of email cannot simply send email (unless I have an open server somewhere that I don’t have), so I will need to log in and send an email server (in in my case gmails server)

so how can i do this?

update:

the above code works, but it doesn’t come from the corporate account, we are currently using Google biz applications, and therefore I would like to log in to the Google server to send this.

+3
7

-, , , . , .

, , - , ISP.

+1

php mail() . linux, sendmail. ,

()

+1

; " " , .

0

Linux, , . -, .

, . , ... smarthost. Linux (exim, postfix, whatever) . , Windows. , Xampp .

PHP, . swiftmailer.

http://swiftmailer.org/ http://phpmailer.worxware.com/

SMTP-, , .

0

, , , , swiftmailer

0

mail(), .

GMail , SMTP Gmails (MTA).

mail() SMTP sendmail . , - . , PHP.ini.

Sendmail - , . ( : SMTP, sendmail ).

sendmail Google, . sendmail. PHP sendmail PHP.ini. , .

, PHP SMTP , Google TLS (/), PHP.ini.

. PHP , sendmail Linux, SMTP - . . PHP Windows, sendmail, linux SMTP. Windows sendmail, linux sendmail , SMTP. Sendmail , , PHP SMTP.

0

Source: https://habr.com/ru/post/1716791/


All Articles