2

I am trying to send the send email using the mail command as

mail -s "subject" email_address < email_text 

but how will I confirm whether email is actually sent or not ( i.e. email_address is wrong or right)

  • 3
    You don't. Not until and unless you receive a message from MAILER-DAEMON telling you your email couldn't be delivered because the remote server said there was no such person. – Shadur Nov 3 '17 at 11:28
  • “Sent” is a separate and distinct step from “email address received it” – Jeff Schaller Nov 3 '17 at 12:08
  • Here mail is an MUA (mail user agent) its job is to pass the message on to the MTA (mail transport agent) validation of the envelope and "sending" of the mail is done by the MTA. The MUA doesn't get told what's happenning in the MTA. – symcbean Nov 3 '17 at 13:49
  • Some MTA may also leave a dead.letter file somewhere if things go awry in a particular way. – thrig Nov 3 '17 at 14:31
0

For check if all the mails are gone the directory /var/spool/mqueue should be empty. This directory contains temporary files associated with the messages in the mail queue and may contain the log file. As example :

# ls -ltr /var/spool/mqueue
-rw-r----- 1 root  smmsp     240 Nov 13 22:11 dftADBBuZl027798
-rw-r----- 1 root  smmsp    1149 Nov 13 23:18 dftADCIacE001585
-rw-r----- 1 root  smmsp   12216 Nov 14 17:06 dftAE666SH027158
-rw-r----- 1 root  smmsp    1530 Nov 14 21:10 qftADCIacE001585
-rw-r----- 1 root  smmsp    1452 Nov 14 21:10 qftADBBuZl027798
-rw-r----- 1 root  smmsp     930 Nov 14 21:33 qftABDxS6e024439

The df file contains the body of the email that has been queued. The qf file contains all the message headers, plus some other information, such as the (most recent) failure message and the number of attempts made to send this particular email. So you could find your email is not gone.

The df files remain static (until deleted) while the qf files are updated every time this queue is run.

Regards,

0

Daemon-agnostic:

  1. The mailq command will show you a summary of every mail still in the queue. Every daemon that adheres to the standards will implement this command, so it should work.

  2. Look in (almost always, but might vary slightly per distro) /var/log/mail.log for lines matching the destination address, then follow what happened to that particular message, and what response it received from the remote server when trying to deliver it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.