smtp mail logic clarification

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

smtp mail logic clarification

Post by raghavan20 »

let us say there are two servers
1. server one runs a smtp program to send mails
2. server two runs a web application and the web application sends emails using server one's smtp

let us assume there is a situation like this.
server one goes down and it means smtp program is not running
server two is running and the web application is also running
web app in server 2 keeps sending mails eventhough server one is down


my questions
1. what will happen to all the mails that are sent by web app in server 2 to server 1 when server 1 is down?
2. if they will be delivered, can you explain how this process actually happens?


thanks for any kind of information you are going to provide me in this context.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

If the SMTP server is down you're semi-screwed.

You can configure sendmail to run on the server with the mailing application so that it uses the other server as a "smart host" to pass mail to when it's available. You still have in issue if sendmail screws up though.

The best solution is to employ some redundant system by using more than one server and making use of Linux Virtual Server (aka LVS) to direct traffic between the two servers when they are available. You can use a tool called heartbeat to determine the network status of the machines and "fail over" if required. This basically allows you to reference a series of machines by one IP address and a monitoring server automatically re-assigns the IP addresses in the event of a server failing. It does mean you have servers sitting there doing nothing half the time though. LVS can load balance between multiple servers rather than just switching in the event of one failing.

So to answer the question in brief: One SMTP server and you're stuck if it fails unless you have coded a way around it or use a sendmail/smarthost configuration. The better solution - use LVS.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

thanks chris.

so can i confirm that if you have sendmail configured on the second server, sendmail program stores the forwarded emails when server1 mail program is down and sends all the mails when server1 mail program is up.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

raghavan20 wrote:thanks chris.

so can i confirm that if you have sendmail configured on the second server, sendmail program stores the forwarded emails when server1 mail program is down and sends all the mails when server1 mail program is up.
Yeah, sendmail always puts things on a queue anyway. Usually it would try to relay the messages by itself, but you can configure it to use a "smart host" (I guess in sendmail.cf but I never use sendmail) where it passes the mail to another server. If the other server is down it will simply be "deferred" on the mail spool. You'll get about 72 hours by default before it gives up.
Post Reply