How to install send mail in ubuntu aws
To install and configure Sendmail on Ubuntu on AWS, follow these steps:
Step 1: Install Sendmail
- Update the package list:
sudo apt update
- Install Sendmail:
sudo apt install sendmail
Step 2: Configure Sendmail
- Edit the Sendmail configuration file:
sudo nano /etc/mail/sendmail.cf
- Add the following lines at the end of the file:
define(`SMART_HOST', `smtp.gmail.com') define(`RELAYHOST', `smtp.gmail.com')
These lines configure Sendmail to use Gmail's SMTP server as the smart host and relay host.
Step 3: Set up Gmail credentials
- Create a new file:
sudo nano /etc/mail/gmail.conf
- Add the following lines:
AuthInfo: "U:[email protected] P:your_password"
Replace
[email protected]
andyour_password
with your actual Gmail credentials.
Step 4: Restart Sendmail
- Restart the Sendmail service:
sudo service sendmail restart
Step 5: Test Sendmail
- Use the
telnet
command to test Sendmail:telnet localhost 25
- Type
HELO example.com
and press Enter. - Type
MAIL FROM:<[email protected]>
and press Enter. - Type
RCPT TO:<[email protected]>
and press Enter. - Type
DATA
and press Enter. - Type your email message and press Enter.
- Type
.
and press Enter to send the email.
Additional Tips
- Make sure to replace
[email protected]
andyour_password
with your actual Gmail credentials. - If you're using a different email provider, you'll need to update the
SMART_HOST
andRELAYHOST
settings accordingly. - You may need to configure your AWS instance's security group to allow outgoing traffic on port 25 (SMTP).
- You can also use other email clients like Postfix or Exim instead of Sendmail.
That's it! You should now be able to send emails using Sendmail on your Ubuntu instance on AWS.