Skip to content

Instantly share code, notes, and snippets.

@adamstac
Last active January 5, 2024 00:01
Show Gist options
  • Star 89 You must be signed in to star a gist
  • Fork 39 You must be signed in to fork a gist
  • Save adamstac/7462202 to your computer and use it in GitHub Desktop.
Save adamstac/7462202 to your computer and use it in GitHub Desktop.
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@yfarooq
Copy link

yfarooq commented Oct 3, 2018

Hi @yfarooq !
Congratulations on the coming New Year!
We would have made the world better if we told how we solved our problems)))
Or not yet solved?
The problem in determining the e-mail address in the listing about this is written, the address should be of the form: some@some.zone(add [.zone] to normal resolve mail address).

I still can't get this to work.

Error: /etc/mail/submit.cf: line 6: invalid argument to V line: "ERSIONID(Id: startt"
/etc/mail/submit.cf: line 7: invalid argument to V line: "ERSIONID(Id: autoco"

I tired to comment both line 6 and 7 with # and still can't receive email

@inneroot
Copy link

inneroot commented Dec 4, 2018

'yourhostname' should be long,
that mean, it should have dot com or similar, or you will get error in log:

unable to qualify my own domain name (hostname) - using short name.

@bitridge
Copy link

bitridge commented Jul 9, 2019

For this I think you'll also have to allow gmail on less secure app https://support.google.com/accounts/answer/6010255?hl=en

@NSBSD-InfoTech
Copy link

Its working for me, the problem is the email address showing up on my email is it@localhost, how can I make it to show the hostname of the server and not localhost?

@sarraHa
Copy link

sarraHa commented Dec 3, 2019

Worked fine for me (Ubuntu 18.04), Thanks!

I used this tutorial for ubuntu 18.04
https://www.youtube.com/watch?v=_nwJ63UhJTM

@jet2018
Copy link

jet2018 commented Feb 24, 2020

after doing your steps, i get this
[Mon Feb 24 09:50:24.782752 2020] [mpm_prefork:notice] [pid 11060] AH00169: caught SIGTERM, shutting down
[Mon Feb 24 09:52:08.852440 2020] [mpm_prefork:notice] [pid 1128] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Mon Feb 24 09:52:09.024401 2020] [core:notice] [pid 1128] AH00094: Command line: '/usr/sbin/apache2'

what do i do?

@iotstudent
Copy link

pls how do i locate the sendmail.ini file in ubuntu 18

@bhaijiyunus
Copy link

bhaijiyunus commented Apr 16, 2020

HI,
I run the below commands on my Ubuntu 18.04 to configure the sendemail/sendmail, I am getting email success message but never received an email. Help will appreciate. Thanks.
Apr 16 15:45:01 ubuntu sendemail[29360]: Email was sent successfully!
systemctl stop postfix
sudo apt remove postfix
sudo apt purge postfix
sudo apt-get install mailutils
sudo apt-get install sendmail sendemai

@charity1475
Copy link

How to make sendmail work in a LAN? or between two computers connected via eht0

@bitridge
Copy link

How to make sendmail work in a LAN? or between two computers connected via eht0

Good question, I'm following

@Dissorder
Copy link

Hi @bhaijiyunus I'm getting the same issue. Were you able to solve it?

@thesimonshields
Copy link

Not working for me either

wondering if I could get the code and compile it

i get errors around missing packages javascript-common & sometimes java-common

sudo apt -f install sendmail
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-5.4.0-74-generic linux-headers-5.4.0-77-generic linux-hwe-5.4-headers-5.4.0-56 linux-hwe-5.4-headers-5.4.0-58
linux-hwe-5.4-headers-5.4.0-74 linux-hwe-5.4-headers-5.4.0-77 linux-image-5.4.0-74-generic linux-image-5.4.0-77-generic
linux-modules-5.4.0-74-generic linux-modules-5.4.0-77-generic linux-modules-extra-5.4.0-74-generic linux-modules-extra-5.4.0-77-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
liblockfile-bin liblockfile1 lockfile-progs procmail sendmail-base sendmail-bin sendmail-cf sensible-mda
Suggested packages:
sendmail-doc rmail logcheck resolvconf sasl2-bin
The following NEW packages will be installed:
liblockfile-bin liblockfile1 lockfile-progs procmail sendmail sendmail-base sendmail-bin sendmail-cf sensible-mda
0 to upgrade, 9 to newly install, 0 to remove and 292 not to upgrade.
Need to get 0 B/899 kB of archives.
After this operation, 4,449 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package liblockfile-bin.
dpkg: warning: files list file for package 'javascript-common' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
files list file for package 'libv4l-0:i386' contains empty filename
E: Sub-process /usr/bin/dpkg returned an error code (2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment