recover smtp mail text files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers recover smtp mail text files
# 8  
Old 10-01-2008
see if you have mbpath installed (part of the cysrus package). This should enable you to find out the correct location of the users mail spool. Under that there may be hidden directories and files, so ls -a will help.

here is the man page for formail (sorry, I misspelled it earlier)
formail
which is probably what you will end up using as once you have the hang of it, it is so easy to script.
# 9  
Old 10-01-2008
I have mbpath installed on the server. I ran it from command line as follows :

/usr/cyrus/bin/mbpath <users directory name from /var/spool/imap/user>

but i get the following message :

Invalid mailbox name: <directory name>

sorry if I've ran that wrong
# 10  
Old 10-02-2008
formail as such doesn't really help here, it's useful for splitting an mbox file into individual messages and replacing headers, but I don't think you need either here.

A somewhat desperate but perhaps acceptable workaround would be to simply resend those messages. Some Received: headers will be added and you might get the wrong envelope sender, but those might not be of any importance to you.
# 11  
Old 10-02-2008
sorry if this a dumb question but how can I resend the text files? :-)
# 12  
Old 10-02-2008
If you have a file which contains a valid email message, just submit it with sendmail. It should have some headers, an empty line, and a body. I supply an example below.

Given a set of files like this, you can send them with sendmail:

Code:
for f in 9*; do  # loop over all files named 9* in current directory
  sendmail -oi recipient@example.net <"$f"
done

Here's what a simple email message looks like. It's just a text file.

Code:
From: Benevolent Sender <sender@example.org>
To: Happy Recipient <recipient@example.net>
Subject: This be a message
Date: Tue, 01 Apr 2008 00:00:00 +0000
X-Header: there can be random other headers

Hi there.  You have m@il! O_o

If there's a "From " line (without a colon) as the first line, you want to discard that somehow. sed '1{;/^From /d;}' would seem like a typical way to do that.

There are likely to be Received: headers and what not, but that's a basic simple message. If you have MIME structure, that adds some complexity as well, but fundamentally, SMTP mail is just a piece of basic 7-bit US-ASCII text. See the RFCs and various tutorials for more information.
# 13  
Old 10-03-2008
Hi era

The for loop worked a treat :-) - thanks for all your help and assitance :-)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Send mail via SMTP

I have a existing perl program , in this program it will output a email address list to a variable ( $email_list ) , mail content to a variable ( $email_content ) , if I want to send all email to these email address with corresponding content , would aadivse how to write a perl script ? thanks (2 Replies)
Discussion started by: ust3
2 Replies

2. Solaris

OutBound SMTP Server Mail issue

Hi all I have a Live SMTP server for outbound mails ( Mail being sent from my organization to outside domains). A large chunk of mails are not being sent and reside in /var/spool/mqueue directory. The header of there mails are: From: Mail Delivery Subsystem <MAILER-DAEMON> How can I... (0 Replies)
Discussion started by: Junaid Subhani
0 Replies

3. Shell Programming and Scripting

Getting error while sending mail via smtp

Hi All, I used before a simple routine code in tcl to send mail. package require smtp package require mime package require Tcl proc send_simple_message {recipient email_server subject body} { set token mime::setheader $token Subject $subject smtp::sendmessage $token \ ... (0 Replies)
Discussion started by: zivsegal
0 Replies

4. Programming

Send mail via SMTP

If anybody has a c/c++ code of send mail via smtp with or without authorization for Linux, I will be very grateful. Thank's. (0 Replies)
Discussion started by: LuckyStr
0 Replies

5. Programming

SMTP mail client C++

Hey Guys, I am writing an SMTP mail client in c++ in unix and it needs to do the following: I need to create a client the client talks to port 25 it sends a hello world message I also need to support and smtpclient class and a clientdriver class I have written the smtpclient class, but I... (1 Reply)
Discussion started by: jcy8096
1 Replies

6. Windows & DOS: Issues & Discussions

Send mail using SMTP

Hi I need to send email from batch script, using SMTP from my exchange server. Can any one send me command line of that should be non interactive. I did using MAPISEND, but i should not use it for some reasons. I have to send this using SMTP for Microsoft Exchange Server. mapisend -u... (2 Replies)
Discussion started by: mohantmk
2 Replies

7. UNIX for Advanced & Expert Users

How to configure Linux box with my SMTP mail server

Hi all, I need to send mail to a particular email id using a local mail server.This mail shall contain the content of a file. I don't have any idea how to do it. Can anyone guide me ,where to start proceeding for it. Any guide or study material would appreciated. (1 Reply)
Discussion started by: amit_kv1983
1 Replies

8. UNIX for Dummies Questions & Answers

sending mail via smtp

Hi Gururs, I have a process on a middelware (SAP XI) that is runnung on HP-UX. This Process is creating a flatfile. Now I want to call a script within the process that sends the created flatfile as attachment via Mail using a smpt-server. The script should have the following input parameters:... (2 Replies)
Discussion started by: elko.hasse
2 Replies

9. IP Networking

SMTP mail

I want to send e-mail from my yahoo account. But mail -s "title" *@yahoo.com < line.txt is from my local address to *@yahoo.com. How can i do this? (1 Reply)
Discussion started by: Euler04
1 Replies

10. UNIX for Advanced & Expert Users

SMTP going to Junk Mail

Hi All I have a slight problem with sending mails from my server - if I send mails to Yahoo! or Hotmail, either direct via the SMTP server, or through sendmail, the email ends up in the account holder's Junk Mail folder. Is something in the headers causing these emails to be treated as junk?... (3 Replies)
Discussion started by: saabir
3 Replies
Login or Register to Ask a Question