Hi i have webshop and want to setup loadbalance with database on separate server, but what will happen when there is newsletter sendind mail. My modest idea is that those webserver wont know who is sent what and may happen to send multiple times? For example, WEB1 trigers sending and then WEB2 triggers sending the same mails.
You put outgoing email jobs into a queue, and then have a worker process (perhaps one on each server) consume queued messages and act on them.
The worker process claims a queue message (making it unavailable for other workers to consume), sends the email, and then ACKs the message after successful completion. If messages aren't ACKed within a certain timeout, they re-appear in the queue for another worker to consume.
RabbitMQ is a well-respected message queuing system. Redis, gearman, and even something like Amazon's Simple Queue Service are other options.