I can't send mail using sendmail from the email form of the site that EC2 operates.

Asked 2 years ago, Updated 2 years ago, 129 views

I am creating a homepage using AWS EC2, and I am thinking of creating an inquiry (email form) page on that homepage.
So I'm trying my best to use this free email form, but it doesn't work.
http://www.synck.com/contents/download/cgi-perl/mailform_jcode.html

EC2 frees SMTP ports, prepares CGI operating environment, introduces Jcode to use mail form, and
"When I pressed the ""Submit"" button from the form, it was displayed until the ""Submit Successful"" screen, but I didn't receive an email."

I thought sendmail was not working well, so I logged in to EC2 with ssh and

$sudo sendmail<Destination email address>

I sent an email, but I didn't receive it.

$sudo service sendmail status 

In , I have verified that sendmail is working.

So, first of all, I'm doing a lot of things to make sendmail work properly in EC2.
The email could not be sent.
How can I get sendmail to work properly?

Also, can you think of any other reason why I can't send emails from the email form?

Additional note (May 19, 2016 18:38) =============================================

Use the submission port
to the security group Configure inbound custom TCP (587) on the EC2 server and

in sendmail.mc
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl

Uncommented the to use the submission port.

However, we will test the operation of seamail as follows.

$sudo sendmail***@softbank.ne.jp
$ From:support@<Domain>
$ To:***@s oftbank.ne.jp
$ Subject:test submission
$
$ This is a test submission.
$ .

I checked /var/spool/mail/ec2-user and found that the transmission failed.

... (omitted)
Arrival-Date: Mon, 16 May 2016 09:25:09 GMT

Final-Recipient: RFC 822;\*\*\*@s oftbank.ne.jp
Action—Failed
Status: 5.1.1
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 550 5.1.1<\*\*\*@s oftbank.ne.jp>...User unknown
Last-Attempt-Date: Mon, 16 May 2016 09:25:45 GMT

--u4G9P9UN003320.\*/ip-\*-\*-\*-\*.ap-northeast-1.compute.internal
Content-Type: message/rfc822
Content-Transfer-Encoding—8 bits
... (omitted)

In addition, it says User unknown, so
I added the domain to the local-host-names file, but it didn't work.

aws sendmail amazon-ec2

2022-09-30 15:32

2 Answers

TCP/25 is blocked, so please use the submission port (TCP/587).

There is also a way to use Amazon SES.Amazon slide shows will be helpful, so I'll introduce them to you→Email from AWS

Measures to avoid spam

  • Whether there are MX records for DNS domains
  • Can DNS query correct the hostname you named in ehlo(hello)?
  • Does it match the host that called itself ehlo(hello) by reverse subtracting the IP
  • Use Route 53 or set MX and A records in your DNS.
  • Reverse withdrawal requires AWS to apply Application form
  • Set the Sender Policy Framework (SPF)/Sender ID
  • Set DKIM (DomainKeys Identified Mail)
  • EIP is a re-use, so past users may be spammed and IP blacklisted.If it is listed after searching to see if it is registered in RBL, it would be good to get the EIP again.
  • Request to Remove Email Sending Limitations can also apply to unsubscribe from RBL

As it is troublesome to set up an SMTP server, it is recommended that you relay EC2 sendmail to SES using SES and Route 53 if it is for transmission only.


2022-09-30 15:32

If the "Send Successfully" screen appears, I think that you will probably enter the mail queue (/var/spool/clientmqueue/, /var/spool/mqueue/) to send mail using sendmail, which runs on the same host as the mail form, but cannot send it outside.

Please check the following

  • Is the sendmail service started?
  • Are there any files in the mail queue (/var/spool/clientmqueue/,/var/spool/mqueue/)?
  • Are there any errors in the mail log (such as /var/log/mailog, /var/log/mail.log)?

If you have the OS, sendmail version, sendmail settings, and logs, you may know what it is.


2022-09-30 15:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.