0

websiteI want my website to automatically generate an email to be sent to a customer when they click the submit button.

I have added the following php:

$subject = "Thank You";
$message = "Thank you .........";
$from = "info@mywebsite.com";
$headers = "From:" . $from;
mail($email, $subject, $message, $headers);

The variable $email was defined earlier. Also I have edited my php.ini to include the following:

SMTP = smtp.mywebsite.com
smtp_port = 25
username = info@mywebsite.com
password = password
sendmail_from = info@mywebsites.com

Clearly I have not done enough. What more do I need to do?

CTViking
  • 99
  • 1
  • 5

1 Answers1

0

This question is duplicate with Sending email with PHP from an SMTP server

PHP mail function has some issue with smtp. (It is not support for smtp user name and password) Use 3rd party mail library like Swift mailer, PHPMailer, etc...

Community
  • 1
  • 1
Dinuka Thilanga
  • 3,990
  • 9
  • 51
  • 89