LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-16-2011, 03:10 AM   #1
darshakamodi
LQ Newbie
 
Registered: Nov 2011
Location: India
Posts: 4

Rep: Reputation: Disabled
Sendmail scheduling mail delivery


Hi,
I have setup Sendmail MTA, my customer sends bulk mailing, due to that we receive error 452, too much mail receipants.
I want to schedule mail in Sendmail, if client has sent mail to 500 receipants, the server will serve in batch of hundres.
Or it will open connection with yahoo/gmail after some time and will deliver message by scheduling it.

How can this be done ??
 
Old 11-16-2011, 07:05 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,360
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by darshakamodi View Post
my customer sends bulk mailing, due to that we receive error 452, too much mail receipants. I want to schedule mail in Sendmail, if client has sent mail to 500 receipants, the server will serve in batch of hundres.
In my opinion that would be the wrong approach. Any sane remote MTA your MTA contacts would (or should) see such bulk mail sending as a threat and a violation. So first bursting up to 500 recipients and only after the fact throttle back to 100 may not (should not) cut it. What you enforce should be part customer education and part throttling. For the next please refer to Sendmail documentation and maybe the O'Reilly "Bat book":
- confMAX_RCPTS_PER_MESSAGE: max recipient/message
- confCONNECTION_RATE_THROTTLE: max new connection/second
- confBAD_RCPT_THROTTLE: punish on bad user names
- tune down any overly long timeout defaults (any confTO_*)
* By default Sendmail runs one queue but you can make it run several based on any filter you can to think of. Each queue can have its own "policy" based on cost, sender, delivery speed etc, etc. See http://www.ilkda.com/sendmail/Queue_Tips.htm for ideas.
- You could apply a maximum limit via Netfilter as well and this can be generic or based on remote port, IP address etc, etc. For example '/sbin/iptables -I OUTPUT -o eth0 -m state --state NEW -p tcp --dport 25 -m limit --limit 50/s --burst-limit 75/s -j ACCEPT' would limit outbound connections to any remote MTA to 50 new connections per second with a maximum of 75 per second.


Quote:
Originally Posted by darshakamodi View Post
Or it will open connection with yahoo/gmail after some time and will deliver message by scheduling it.
Addressing the cause would IMHO be a better long-term solution.
 
Old 11-17-2011, 01:19 AM   #3
darshakamodi
LQ Newbie
 
Registered: Nov 2011
Location: India
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks.. but client has to send 1000 mails daily and he shoots all mail single shot.
I want that sendmail should send 100 mails in one batch and send other 500 after 5 min or 30 mins.

Is that possible to do in sendmail or with any other tool ??
 
Old 11-17-2011, 09:52 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,251

Rep: Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432
Quote:
Originally Posted by darshakamodi View Post
Thanks.. but client has to send 1000 mails daily and he shoots all mail single shot.
I want that sendmail should send 100 mails in one batch and send other 500 after 5 min or 30 mins.

Is that possible to do in sendmail or with any other tool ??
Yes...write a script to process the list of email addresses, and send out 100 at a time.
 
Old 11-17-2011, 10:56 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,360
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by darshakamodi View Post
I want that sendmail should send 100 mails in one batch and send other 500 after 5 min or 30 mins. Is that possible to do in sendmail or with any other tool ??
See http://www.brandonhutchinson.com/Cre...il_mailer.html
 
Old 11-17-2011, 10:58 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,360
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by TB0ne View Post
Yes...write a script to process the list of email addresses, and send out 100 at a time.
Interesting. Where would you hook that into the MSA? Could I ask you to post an example or general outline of the process? (Pseudo) code welcome of course.
 
Old 11-17-2011, 12:09 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,251

Rep: Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432
Quote:
Originally Posted by unSpawn View Post
Interesting. Where would you hook that into the MSA? Could I ask you to post an example or general outline of the process? (Pseudo) code welcome of course.
Well, without knowing how the OP has the addresses stored/available, what other user info they have available (will assume a customer database), or knowing the content of the email (I'm assuming a form-letter), I can't be very specific, so pseudo code will have to do.
  • Read the list of addresses into an array (could also use record #'s from the DB)
  • Assign name variables (first/last, only if email needs to be 'customized', as in "Dear xxxx,")
  • Replace the xxxx in the email with the name (again, only if customization needed)
  • Send emails and tick up a counter with each one.
  • Hit 100? Sleep for xxx time, so mail server isn't taxed
  • Reset counter
  • Loops back until array/records are processed
This is only one solution, and depends heavily on the tools available to the OP, how the data is stored, and the real goal of things. There's probably a zillion ways to do this.
 
Old 11-17-2011, 11:37 PM   #8
darshakamodi
LQ Newbie
 
Registered: Nov 2011
Location: India
Posts: 4

Original Poster
Rep: Reputation: Disabled
Opps!.. I am not that good at coding & sendmail.
Is there any configuration , that sendmail sends 100 mails and sleeps for 30 mins, and sends again 100.??

The client uses our sendmail as SMTP only.
I want gmail.com should be sent 50 mails in 1 min,yahoo.com 50 in 1 min, and then sleep for sometime and then again restarts.

Can it be done through configuration?
Or any third party programe for that?
 
0 members found this post helpful.
Old 11-18-2011, 09:35 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,251

Rep: Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432
Quote:
Originally Posted by darshakamodi View Post
Opps!.. I am not that good at coding & sendmail.
Then perhaps you should learn. There are thousands of scripting tutorials, example code, etc., that you can easily find with a quick Google search.
Quote:
Is there any configuration , that sendmail sends 100 mails and sleeps for 30 mins, and sends again 100.??
No. Sendmail does just that...it SENDS MAIL. If you queue up 50,000 messages, it'll send them as soon as they're queued, as fast as it can.
Quote:
The client uses our sendmail as SMTP only. I want gmail.com should be sent 50 mails in 1 min,yahoo.com 50 in 1 min, and then sleep for sometime and then again restarts.

Can it be done through configuration? Or any third party programe for that?
No, again..not through configuration. The "third party program" would be the script I mentioned that you need to write.
 
Old 11-19-2011, 12:40 AM   #10
darshakamodi
LQ Newbie
 
Registered: Nov 2011
Location: India
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks a lot. Could you plz guide me where to start? any links/materials?

Appreciate your help.
 
Old 11-19-2011, 04:09 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,360
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by TB0ne View Post
  • Read the list of addresses into an array (could also use record #'s from the DB)
  • (..)
  • Loops back until array/records are processed
Thanks but that would seem to be an example of a well-behaving sender-side application and, if you read well, unfortunately not applicable given the description of the customer the OP has to work with: "Thanks.. but client has to send 1000 mails daily and he shoots all mail single shot.".


Quote:
Originally Posted by TB0ne View Post
No. Sendmail does just that...it SENDS MAIL. If you queue up 50,000 messages, it'll send them as soon as they're queued, as fast as it can.
...in a default configuration, yes.


Quote:
Originally Posted by TB0ne View Post
No, again..not through configuration.
Well, if you put that this authoritatively then you probably have more Sendmail knowledge than I do. Else perhaps you read to quickly over my link about using queues?.. Sure it won't fix the OP's part wrt educating users but it sure shows how to throttle sending email.
 
Old 11-19-2011, 05:53 PM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,251

Rep: Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432Reputation: 4432
Quote:
Originally Posted by unSpawn View Post
Thanks but that would seem to be an example of a well-behaving sender-side application and, if you read well, unfortunately not applicable given the description of the customer the OP has to work with: "Thanks.. but client has to send 1000 mails daily and he shoots all mail single shot.".
True, but I was just saying how I would handle it, and replying with the pseudo-code.
Quote:
Well, if you put that this authoritatively then you probably have more Sendmail knowledge than I do. Else perhaps you read to quickly over my link about using queues?.. Sure it won't fix the OP's part wrt educating users but it sure shows how to throttle sending email.
Quite true...I stand corrected.

Last edited by TB0ne; 11-19-2011 at 05:54 PM.
 
Old 11-19-2011, 07:56 PM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,360
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by TB0ne View Post
True, but I was just saying how I would handle it, and replying with the pseudo-code.
Sure, and I don't disagree with that common sense approach. Regardless of what is posted it looks like the OP only responds to what he (thinks he) wants and not to what he needs ;-p
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
E-Mail Read Receipt E-Mail Delivery Status E-Mail tracking number. ytd Linux - Software 3 02-14-2009 05:02 AM
Cause of sendmail delivery delays tajamari Linux - Server 2 09-01-2008 07:03 AM
sendmail mail delivery Ammad Linux - Networking 2 11-30-2006 01:32 AM
Sendmail Delivery Issue kaplan71 Linux - Software 4 09-15-2006 03:54 PM
Sendmail local delivery watchamaka Linux - Networking 6 12-13-2003 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration