?
Solved

Forwarding Mail from Mailbox

Posted on 1998-04-21
9
Medium Priority
?
368 Views
Last Modified: 2010-04-21
Hi...

I have a system setup that forwards mail automatically to another system. When that other system is down it stores it in a mailbox.
My question is what command do I use to re-send the messages in that mailbox when the system comes up again.
Suppose the mailbox is in the file: /var/mail/root

The complication is that I want the messages sent as individual messages as they came in the box not as one big message going out.

Thanks for your help.
0
Comment
Question by:goodboy042198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 

Author Comment

by:goodboy042198
ID: 2006362
I tried the command:
mail email@address.com < /var/mail/root
and the message came out as one big one instead of little individual ones.

Hope you can help.
Thanks.
0
 
LVL 1

Expert Comment

by:OM
ID: 2006363
Waht box are you using ? What mailer are you using ?
If you use sendmail it is a already a feature.

0
 

Author Comment

by:goodboy042198
ID: 2006364
Yes I am using Sendmail. What command would I use?

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:OM
ID: 2006365
man sendmail :

     -q[time]        Process saved messages in the queue at given
                    intervals.   If  time is omitted, process the
                    queue  once.   time  is  given  as  a  tagged
                    number,   with   s  being  seconds,  m  being
                    minutes, h being hours, d being days,  and  w
                    being  weeks.   For example, -q1h30m or -q90m
                    would both set the timeout to one hour thirty
                    minutes.

0
 

Author Comment

by:goodboy042198
ID: 2006366
Hi..

Unfortunately this won't work because the mail is no longer in the queue but has been sent to a mailbox.
Is there a way around this?

0
 
LVL 1

Accepted Solution

by:
OM earned 200 total points
ID: 2006367
nawk 'BEGIN{cmd="/usr/lib/sendmail -t";} /^From /{close(cmd); next;} {print | cmd }' < /var/mail/root

Funny, isn't it ?
0
 

Author Comment

by:goodboy042198
ID: 2006368
Terrific. Thank you very very much. It works great.
Before you take the points and run off :o) could you just answer a quick question... i gather this is a script that reads in each line of the mailbox and separates each message by the "From " 
string..  is that correct? what if in the message itself there was a From string? I am sorry about all these questions i just want to be sure that it will always works.

Thanks. again

0
 
LVL 1

Expert Comment

by:OM
ID: 2006369
The script is spliting mailbox with File *begining* with
"From ". Mailer should replace lines begining with "From "
by " From " for example. If it is not done, you have to
consider the length of the body (if set) in the mail headers.
This will give you a little bit longer script but this
is possible to do it.
0
 

Author Comment

by:goodboy042198
ID: 2006370
Ok. This is what I thought. Thanks again!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question