[SOLVED] Reading dead.letter

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED] Reading dead.letter

Postby hankivy » Jul 5th, '15, 08:27

Several places in my system there are files called, dead.letter. Using VIM, these are text files that look a lot like email messages. But the dead.letter file is not recognized as a mailbox by the mutt mail reader application. The file does not contain any email delimiter line values like "From ", or four control-A characters. What is the best way to view these files and deal with the parts of the file that look like an individual email?

Here is a small sample
Code: Select all
Date: Wed, 01 Aug 2012 13:58:03 -0500
To: root
Subject: hivylinux Communications with UPS restored
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Subject: hivylinux Communications with UPS restored
 
hivylinux Communications with UPS restored
 
APC      : 001,034,0824
DATE     : 2012-08-01 13:58:02 -0500 
HOSTNAME : hivylinux
VERSION  : 3.14.8 (16 January 2010) mandrake
UPSNAME  : hivylinux
CABLE    : USB Cable
MODEL    : CP685AVR-G
UPSMODE  : Stand Alone
STARTTIME: 2012-08-01 00:46:58 -0500 
STATUS   : ONLINE
LINEV    : 124.0 Volts
Last edited by hankivy on Jul 8th, '15, 04:28, edited 1 time in total.
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36

Re: Reading dead.letter

Postby ozky » Jul 5th, '15, 10:27

You can find your answer from wikipedia.
https://en.wikipedia.org/wiki/Dead_letter_mail
Image
Mageia user
User avatar
ozky
 
Posts: 581
Joined: Jul 2nd, '11, 08:48
Location: Nakkila Finland

Re: Reading dead.letter

Postby hankivy » Jul 5th, '15, 20:50

The wikipedia entry discusses the practical issues and concept of "dead letter" for a physical stamp, and letter at my downtown government run post office. The google searchs reveal links asking questions like: "What is the file? Why does it keep growing? Who is making it grow?". I generally understand the answers to all of those questions. The contents of the file are partial, (or full) email messages that could not be delivered to an acceptable email account. The reasons for non-delivery range from simply not having an email address destination, to complex email server configuration issues.

In the example, in the first post in this topic, the dead.letter file only had one email message. Looking at that example, I knew I could just delete the file. In a more involved case, the file will contain multiple partial email messages. I want a process and/or application that will show me the individual emails, and allow me to delete or resend each message to the correct email account. How? :?:
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36

Re: Reading dead.letter

Postby jkerr82508 » Jul 5th, '15, 21:47

You need to install a Mail Transport Agent (MTA). This will "deliver" the email. You then can use an a mail client which can "collect" and display those emails.

I use postfix as my MTA and a Unix-movemail account in thunderbird to read them.

A simple MTA is DMA: https://wiki.mageia.org/en/Dma_Dragonfly_Mail_Agent

Jim
jkerr82508
 
Posts: 946
Joined: Mar 26th, '11, 01:34
Location: Fife, Scotland

Re: Reading dead.letter

Postby hankivy » Jul 6th, '15, 05:18

I have two issues on my system:

1. Why are emails ending up in the dead.letter file?
2. How to deal easily with the emails already in the dead.letter file?

I want to handle the last problem first. It should help understand which processes are sending each email if I can read each email as a separate message, and not just a lot of lines in a 4.5MB file. I would like to send each email to the proper user.

P.S. My system does not seem to have a Mail Transport Agent. My system does not have any of these packages: dma (Dragonfly Mail Agent), sendmail, nor postfix. Thank you for the suggestion.
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36

Re: Reading dead.letter

Postby filip » Jul 6th, '15, 08:20

hankivy wrote:1. Why are emails ending up in the dead.letter file?
As Jim already wrote. Your system doesn't have Mail Transport Agent (MTA) so it "delivers" all email to that file so it's not lost.

hankivy wrote:I would like to send each email to the proper user.
In default install there is only email for the root user. Mostly there are security results and some system notification.

hankivy wrote:P.S. My system does not seem to have a Mail Transport Agent. My system does not have any of these packages: dma (Dragonfly Mail Agent), sendmail, nor postfix. Thank you for the suggestion.
I use very simple sendmail "clone" written in php for my use case but Dragonfly Mail Agent seems simple and effective enough too.
filip
 
Posts: 478
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia

Re: Reading dead.letter

Postby hankivy » Jul 8th, '15, 04:27

My Mageia 4 system had two issues. There was some missing software, and some files that were awkward to deal with.

I installed dma (Dragonfly Mail Agent), configured a dma alias to put root's emails in my default mbox mail file, and configured my kmail to look at /var/spool/mail/hank for an mbox mail file.
[hank is my user id on the system.] Now the emails come to me to deal with. :)

The files awkward to deal with, dead.letter, contained old undelivered emails. I used vim to look at the files, and just dealt with the issues described in the messages.

--- A more programmatic approach to dead.letter files.

A script could add header lines to the dead.letter file at the beginning of each email message, and the result could be concatenated to the end of an mbox mail file for a user.

It could go to my default mbox mail file, and I would read the messages using my kmail.

It could go to the root user's mbox mail file. Here are the commands to find the default root user's mbox mail file.
Code: Select all
[hank@HIvyTower ~]$ sudo su - root
[root@HIvyTower ~]# env | grep -i mail
MAIL=/var/spool/mail/root
[root@HIvyTower ~]#
If you want a command line email client to read root's email, then "mutt" is a good application to use.

Each of the email messages started like this:
Code: Select all
Date: Sun, 05 Jul 2015 14:44:19 -0500
To: root
Subject: [msec] *** Security Check on HIvyTower, Jul 05 14:44:18 ***


The script would add header lines to look like this:
Code: Select all
From root@HIvyTower     Mon Jul  6 04:02:05 2015
Received: from root (uid 0)
        (envelope-from root@HIvyTower)
        id 400d7
        by HIvyTower (DragonFly Mail Agent 0.9);
        Mon, 06 Jul 2015 04:02:05 -0500
Date: Mon, 06 Jul 2015 04:02:05 -0500
To: root
Subject: [msec] *** Diff Check on HIvyTower, Jul 06 04:02:03 ***


You can find the pathname of the default mbox mail file of the root user with commands like this:
Code: Select all
[hank@HIvyTower ~]$ sudo su - root
[root@HIvyTower ~]# env | grep -i mail
MAIL=/var/spool/mail/root
[root@HIvyTower ~]#
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36

Re: Reading dead.letter

Postby filip » Jul 8th, '15, 07:51

hankivy wrote:
Code: Select all
$ sudo su - root


To gain root access in Mageia I only use:
Code: Select all
$su -
filip
 
Posts: 478
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia

Re: Reading dead.letter

Postby doktor5000 » Jul 8th, '15, 08:46

hankivy wrote:A script could add header lines to the dead.letter file at the beginning of each email message, and the result could be concatenated to the end of an mbox mail file for a user.


Are you saying you still want such a script, or do you want to create such a script?
Or are you saying that mutt is sufficient for you to read through it?

Didn't really get that from your post.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18049
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

dead.letter Solved

Postby hankivy » Jul 8th, '15, 20:54

I meant to say I am happy. :D Also to document the issues and options for dealing with the existence of the dead.letter file.

Specifically, I am satisfied with the state of my system, vis-a-vis dead.letter. And do not have a need for such a script at this time. And that anyone who wanted to read the dead.letter file as a collection of emails could use such a fairly simple script, to assist with that goal.

Also, that mutt is a good character-terminal mail reader application.
And that a user (who launches a terminal, switches to the root user in the terminal, and wants to read the root user's email) could use mutt to get the job done, in the terminal window.

I may have tried to say too many things in one topic.
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest

cron