getting mails from remote mail server is slow,so need an intermediate server
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
getting mails from remote mail server is slow,so need an intermediate server
Hi all,
I need a solution to a problem one of my client is having.They have a remote mail server in another country,and getting mails from this server is really slow.So they want an intermediary mail server at their office so that,they can be getting their mails from this second mail server,but then,a copy of the mails should be left on the remote server.Any ideas?Please
On my system I have a cron job copy the mail spool file from one server over SCP (Secure copy), and then append it to the mail spool file on my local system. You could just as easily make "local system" a mail server running a POP3 server.
The only thing that is needed for this to work is to have SSH authentication set up using public/private key's (SCP uses the same authentication as SSH), as the background job won't be able to ask for a password. There are a number of tutorials on setting up keyed authentication.
Hi Chadl,thanx.I was thinking,can't fetchmail do what you said could be done here above?
Yes, fetchmail can do exactly the same thing. The only reason that I use SCP in my setup is because my computer is behind a firewall that prevents inbound connections, so I have my computer make an outgoing SCP connection instead.
I also think that the fewer services that I run that are open to the internet, the fewer security holes that my system's could have.
Yeah,thats true.I have never used SCP before.Is there suppose to be some configurations at the remote server end,if one was to use SCP?
SCP works over the SSH protocol, so if SSH works, then SCP will also work.
The only requirement that this script adds is that you will need to have public/private key's setup for login, because the script will run in the background and can not accept passwords.
Here is a tutorial covering how to set-up authentication over SSH using keys: http://www.linuxquestions.org/linux/..._Keys_with_SSH
Here is the script that I have running on my computer to get the mail from the remote server:
Code:
#!/bin/bash
scp example.com:/var/spool/mail/chadl /tmp/mail_$$
if [ $? -eq 0 ]&&[ -s /tmp/mail_$$ ]; then
cat /tmp/mail_$$ >> /usr/spool/mail/chadl
ssh chadl@example.com "echo -n '' > /var/spool/mail/chadl"
fi
rm /tmp/mail_$$
Note that this script removes the mail from the remote server. In order to change that you can remove line 5 that tells the server to empty the remote mail file.
Just removing this line will cause problems without doing something else, however, as it will result in the same mail being downloaded from the server and thus duplicated on the local mail spool.
I can not think of an easy way to fix this off the top of my head, but I will post if an idea comes to me.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.