How to configure send mail in ubuntu
Configuring sendmail in Ubuntu involves several steps, including installing the sendmail package, configuring the sendmail daemon, and setting up the mail server. Here's a step-by-step guide to help you configure sendmail in Ubuntu:
Step 1: Install sendmail
Open a terminal and run the following command to install sendmail:
sudo apt-get install sendmail
Step 2: Configure sendmail daemon
Edit the sendmail configuration file using the following command:
sudo nano /etc/sendmail.cf
Add the following lines to the end of the file:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
This configuration tells sendmail to listen on port 25 and only accept connections from the local machine.
Step 3: Set up the mail server
Create a new file called /etc/postfix/main.cf
using the following command:
sudo nano /etc/postfix/main.cf
Add the following lines to the file:
myhostname = your_hostname
mydestination = your_hostname
mynetworks = 127.0.0.0/8 [::1]/128
Replace your_hostname
with the hostname of your Ubuntu machine.
Step 4: Configure sendmail to use postfix
Edit the sendmail configuration file again using the following command:
sudo nano /etc/sendmail.cf
Add the following lines to the end of the file:
FEATURE(`access_db')
FEATURE(`vrfy_delay', `5m')
FEATURE(`delay_checks', `5')
This configuration tells sendmail to use the postfix mail server.
Step 5: Restart sendmail and postfix
Restart the sendmail and postfix services using the following commands:
sudo service sendmail restart
sudo service postfix restart
Step 6: Test sendmail
Use the following command to test sendmail:
echo "Test email" | mail -s "Test email" [email protected]
Replace [email protected]
with the email address you want to send the test email to.
Step 7: Configure your email client
Configure your email client to use the sendmail server. The exact steps will depend on your email client, but you'll typically need to enter the following information:
- Server:
localhost
- Port:
25
- Username:
your_username
- Password:
your_password
Replace your_username
and your_password
with your email account credentials.
That's it! You should now be able to send emails using sendmail in Ubuntu.