0

I have made a little web application project that has a contact.php page with a form to send emails. However, emails are sent neither by my localhost on my PC before uploading to the EC2, nor by the contact form on the webpage. I don't get any error messages, the emails simply don't send.

if(isset($_POST['submit'])) {

     $to         = "myemailaddress@mydomain.com";
     $subject    = wordwrap($_POST['subject'], 70);
     $body       = $_POST['body'];
     $header     = "From: " .$_POST['email'];


     // send email
     mail($to, $subject, $body, $headers);

 } 

What I need is for the EC2-hosted web contact form to sent emails through a Japanese mail server called onamae.com, and I can deal with reading and replying to the mails in Thunderbird later.

I tried watching Youtube tutorials and reading many articles, but I'm confused about what to do. Different sources offer different answers to the problem. Should I:

  • try to change the php.ini and sendmail.ini files through the Linux command line in Putty?
  • Install sendmail on the EC2?
  • Set up receiving emails using Amazon SES or Amazon Workmail?
  • Install PhpMailer on the EC2 instance and try using that?

Most of the other resources I find don't seem to have my exact problem. But I have very limited experience so maybe there's an article or video out that that DOES explain how to solve my problem and I just couldn't recognize it. Please help this noob developer out, it would be highly appreciated. Cheers.

Taylor
  • 13
  • 3
  • 2
    Or this? https://stackoverflow.com/questions/35206129/php-function-mail-doesnt-work-on-aws-ec2-server – Nico Haase Jul 30 '21 at 06:21
  • 2
    Or this? https://stackoverflow.com/questions/42196421/php-mail-function-is-not-working-in-aws-ec2 – Nico Haase Jul 30 '21 at 06:22
  • 2
    Or this? https://stackoverflow.com/questions/59980226/how-to-send-mail-from-aws-server-using-php-mail – Nico Haase Jul 30 '21 at 06:22
  • The other users seem to be using Ubuntu or Windows Server. The install methods and file systems aren't the same as what I'm using. I tried installing sendmail but it didn't send a test email. – Taylor Jul 30 '21 at 09:38

0 Answers0