3

I am using amazon Ec2 instance with centos 6.4. I tried this and i got error

echo "hello" | sendmail turnip21@gmail.com 
sendmail: Cannot open mail:25

How can i fix that error

Some more info

$ ls -l /usr/sbin/sendmail
139512 lrwxrwxrwx 1 root root 21 Jul  1 15:13 /usr/sbin/sendmail -> /etc/alternatives/mta
$ man mta
No manual entry for mta
Pandora
  • 135
  • 1
  • 3
  • 7

2 Answers2

2

Assuming your firewall,confs, and so on are A-OK you shouldn't be using EC2 for anything email related.

Large swaths of the EC2 netblocks are more or less permanently blacklisted (or severely penalized) by several major email providers.

And on top of that Amazon blocks most of these as well.

There's a particular form that you can fill in to request the removal of those limitations That won't remove you from the blacklists of other e-mail operators though.

It would be a bit better to use SNS but what you'd definitely want is Amazon SES (Simple Email Service) although it's in beta.

user
  • 1,408
  • 8
  • 10
  • I have edited my question for more info. Alhtough i should use SES but atleast i should be able to send email. how can i make send mail working. what configuration i need to execute – Pandora Jul 10 '13 at 09:42
  • @Pandora You should configure Sendmail to pass its email through SES. – ceejayoz Apr 25 '16 at 14:20
  • SES is not required for EC2 smtp. "Should" is not the appropriate context here, rather "could". Amazon does not "block most of these as well" presuming you mean EC2 netblocks. – jeffmcneill Sep 10 '17 at 16:17
0

The port is blocked by either a firewall, AWS Security Groups, or both, but probably just another process running which is bound to 25.

Perhaps another MTA is running which is using port 25? For example Exim, Postfix, Qmail. Try netstat -tulpn | grep :25

Also, ensure that no port filtering is hampering:

  • Check IPTables which should not have outbound port blocks, at least enable 25
  • Check the Security Group(s) applied to the EC2 instance, outbound traffic is generally open for all ports to all addresses, at least enable 25

Note, for full functionality, both udp port 53 and tcp port 53 need to be enabled.

jeffmcneill
  • 169
  • 6