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

echo "hello" | sendmail [email protected] 
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

2 Answers 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.

  • 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, 2013 at 9:42
  • @Pandora You should configure Sendmail to pass its email through SES.
    – ceejayoz
    Apr 25, 2016 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. Sep 10, 2017 at 16:17

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .