Forwarding all incoming mails

Posted: September 23, 2008 in SENDMAIL, SMTP
Tags:

Forwarding all incoming mails

Typical situation: So far you have used address A. Now you have a new address (B) or are using another address (B) temporarily and you want all mails received at A to be forwarded to address B.

Question:
How do I forward all mails from A to B?

Answer:
Create the file “$HOME/.forward” with only the address B in it. (The program which receives the mail hopefully knows the system of forwarding by the “forward file”.) The permissions of the “forward” must be “600”. [Could be OS specific, but nevertheless is a good idea.]

Example:
Let us assume the following values for the two addresses A and B:

	address A := "guckes@inf.fu-berlin.de"
	address B := "guckes@math.fu-berlin.de"

Now create the “forward file” on a host on the domain “inf.fu-berlin.de”:

	echo "guckes@math.fu-berlin.de" > $HOME/.forward

That’s it!

Caveat:
Make sure that you do not create “loops”, ie creating a “forward file” on both system, sending all the mail from the one system to the other.

 


 

 

Forwarding to more than one address

Keeping a local copy

Assume you receive mail at address A. You forward all mails to address B but you want a copy of *all* mails sent to address C. Then put “\C, B” into your “forward file”. The backslash (“\”) before address C will tell the MTA to send a copy to C. And the “B” tells the MTA to forward the mail to address B.

Example:

	$ cat $HOME/.forward
	\guckes@zedat.fu-berlin.de,guckes@inf.fu-berlin.de

With this you can also leave a copy of your mail in the local mailbox by specifying your local userid:

Example:
	$ cat $HOME/.forward
	\guckes,guckes@inf.fu-berlin.de

If you want to change the received mail before forwarding it then you must use a “filter” program.
[950609,950927,951023]

 


 

 

Forwarding one mail

Forwarding a single mail is as easy as using the command “forward” (“f”) from the Folder Menu. You then have to answer the following prompts: (1) edit (prompt for confirmation), (2) send (prompt for addresses), (3) subject (prompt for new/changed subject).

Prompt#1: To edit ot not to edit – that is the question: [*]

Command: Forward                              Edit outgoing message? (y/n) y

You should answer with ‘y’ for two reasons:

Header weeding
The header of the mail is not weeded by default. Please do so to cut down on the message!   

Info for recipients
It is not always obvious why you forwarded the mail. Please add a note saying why you did so. Instruct the reader what to do, eg “please reply to sender” or “please reply to me”. Or just say “for your information” or “just for laughs”. Whatever. Just say *something* about it!   

Prompt#2: Send. “Who shall receive this?”

Send the message to:

Now enter the recipients’ addresses or aliases. If you don’t enter an address then this will abort the command and you will have to start again.

If you want to continue but don’t know the address or alias of the recipient here then just enter something (eg a dot – ‘.’) – you can correct it later via the “h)eaders” menu:

 

Send the message to: .

Prompt#3: Subject: “What’s it all about?”

Subject: Re: previous subject line (fwd)

ELM suggest you use the same Subject line as the forwarded mail had and adds “(fwd)” to notify that this is a forwarded mail. However, you need not accept this – you can and should always improve the information in the Subject line!

After entering the Subject ELM will call the editor:

Invoking editor...

From now on you probably know how to continue.


Forwarding more than one mail

Situation: You are looking at a folder and you want to forward several of the mails.

Short answer:

  • 0) Change to the folder with ELM.
  • 1) Tag the mails to forward.
  • 2) Save the tagged mails to a seperate folder.
  • 3) Send the folder.

Longer answer:

  • 0) Use “c” to change to the folder which contains the mails to forward.
  • 1) Use “t” to tag all the mails to be forwarded.
  • 2) Use “s” to save all tagged mails to a file, eg “foo”.
  • 3) Send the file “foo” to the addressee.

 


TODO: Describe how to “send a folder”. Note: If the file is big then you should compress it first.

 

 

Compression of files is usually done with either “compress” or “gzip”. Compressing means to use a code to represent the data in a smaller form. This also means that every bit of information is used, especially the highest or eigth bit. Characters with the highest bit are not “text” any more and thus you get a problem transferring these with email. Therefore you have to convert the compressed file to a text file before sending it. This is usually done with “uuencode”.

 

Example:  'gzip file | uuencode | elm -s "forwarded mails" addressee'

Note: The receiver of such a file should have the necessary programs to decode the file and to decompress it, too. So you should ask whether the receiver actually has these programs.

Examples for decoding “uuencoded” files and decompressing the result:

gzip:      'uudecode file | gunzip'
compress:  'uudecode file | uncompress'

Note: The program “BinHex” does the same as “uuencode”, only it uses a different code. The idea behind the program is the same, though, ie convert “binary” data to “text” data. “BinHex” is used on Macintoshes.


 

 

Change of Address

“No account is forever!” – so the saying goes. But what if your the account is closed? Then you certainly need a way to have your mail forwarded.

Several situations are possible: (1) Your account survives for a while. Then you can either have tour mail forwarded with the .forward method or even use a filter or “vacation” to announce your new address. (2) Your account will be terminated. In this case you should ask the admins to forward your mail, but this certainly creates more work. (3) You get yourself a “permanent address” to use always.

 


Permanent Email Address

For every problem there is someone on the net to solve it. [That’s what I say. :-] And to solve the “dying account problem” some sites are specializing in being “permanent addresses”. They give you an address and they will keep it for your so that it may be permanent. Sure, it costs money, but the idea of never having to lose a mail and never having to tell people about your new address is nice.

TODO: list of post office boxes. [960217]


Technical Notes

The “forward mechanism” works via the -> MTA. Thus you can read a bit about this in the manual to the used MTA, eg “man sendmail”:

In addition, if there is a .forward file in a recipient's home directory,
sendmail forwards a copy of each message to the list of recipients that
file contains.  Aliasing can be prevented by preceding the address with a
backslash.

Questions

  • Which permissions for the forward file for which system and MTA?

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s