You are not logged in.

#1 2009-10-28 14:57:45

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Scheduling email sendings - any ideas?

Hello everyone,

I'll soon move to countryside, where I'll get a satellite internet connection. This kind of connection comes with bandwidth quotas, but any data transfer occuring at night time is not taken into account in these quotas.

I'll mainly use my connection for professional purposes, and I happen to send quite heavy emails from time to time. Sometimes these Mb emails are not very urgent so I'd like to be able to automagically send them during the night.

I use Kmail as a mail client if that matters.
I have a router/firewall running Arch.

Could you point me to some directions so I can schedule my emails? I'm not very much into network stuff, but what I'd like to do is, for instance:
- write my email in Kmail
- choose to send it the usual way or send it to my router
- my router would then store it and send it later (at night time, using a cron job for instance)
Could it be done in such way? What would that mean? That I need to set up some kind of SMTP server on my router?

Any tips are welcome,

Thanks.


what goes up must come down

Offline

#2 2009-10-28 21:56:31

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: Scheduling email sendings - any ideas?

I don't know if you could do this gracefully using an SMTP server, but you could hit it with a hammer using iptables:

iptables -A OUTPUT -p tcp --dport smtp -m time --timestart 06:00 --timestop 20:00 -j DROP
iptables -A FORWARD -p tcp --dport smtp -m time --timestart 06:00 --timestop 20:00 -j DROP

This would DROP all outbound SMTP connections between 6am and 8pm which would cause your SMTP MTA to encounter a temporary error and queue the mail. You would probably want to schedule a cronjob for 8.02pm to flush the mail queue too to get mail out as soon as possible.

Offline

#3 2009-10-28 22:20:31

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: Scheduling email sendings - any ideas?

Thanks for your suggestion fukawi2.

I'm no iptabled guru, but if I get you right, you suggest to block every outbound SMTP traffic. The problem is, I'd like to be able to choose whether an email should be sent instantly, or delayed to night time.

I thought maybe I could set up an SMTP server on my router, then when sending an email I could choose what SMTP server to use:
- my SMTP server so that the email will be sent during the proper time window
- my ISP's SMPT server in order to sent the email instantly

Indeed, I don't know if I can do so with a dedicated SMTP server. Still investigating.
I don't have much experience with personal SMTP servers, but I think ISP don't like them too much, because they potentially relay spam. That's why I'm OK to consider any other suggestion as well.


what goes up must come down

Offline

#4 2009-10-28 23:22:45

gog
Member
Registered: 2009-10-13
Posts: 103

Re: Scheduling email sendings - any ideas?

does kmail allow changing smtp options? if so

read msmtp in wiki

then download this http://sourceforge.net/projects/msmtp/files/msmtpqueue/

and make a cronjob do msmtp-runqueue.sh at the time you want

Offline

#5 2009-10-29 00:26:12

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,222
Website

Re: Scheduling email sendings - any ideas?

brazzmonkey wrote:

- my SMTP server so that the email will be sent during the proper time window
- my ISP's SMPT server in order to sent the email instantly

Just use the "OUTPUT" rule from my first post... This will stop the *router* making outbound 25 connections, but won't stop your desktop/laptop routing through the router on port 25...

Offline

#6 2009-10-29 08:41:44

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: Scheduling email sendings - any ideas?

@gog
I tried to run msmtp in the past, but I had issue to make it work with my ISP's SMTP server. I'll try again.

@fukawi2
ok, thanks.

I'll experiment your suggestions by this week-end.


what goes up must come down

Offline

#7 2010-01-05 21:18:11

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: Scheduling email sendings - any ideas?

I come back to this thread because I am currently trying to set up msmtpqueue. But I'm a bit lost...

I installed msmtp on my gateway PC. But I don't know how to configure my workstations mail clients to use this remote msmtp.
Or I am wrong? msmtp is considered as a SMTP client, maybe I should use an SMTP server for this task?

Thanks for any guidance.


what goes up must come down

Offline

#8 2010-01-07 06:50:06

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: Scheduling email sendings - any ideas?

*shameless bump*


what goes up must come down

Offline

#9 2010-01-07 08:01:38

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Scheduling email sendings - any ideas?

Not sure how automated you want it - the more automated, the more rules you'd have to build in to make it workable.

Instead you could just tell kmail not to send stuff immediately or save these big emails as drafts for later transmission - just a thought smile


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#10 2010-01-07 09:32:45

chpln
Member
From: Australia
Registered: 2009-09-17
Posts: 361

Re: Scheduling email sendings - any ideas?

I was surprised when I couldn't find documentation to do this easily with any of the usual MTAs.  And I've never used msmtpqueue before, so I'm no help there.   However, I will offer another idea.

Specifically, I'd be looking into postfix, and integrating it with your idea above.

brazzmonkey wrote:

I thought maybe I could set up an SMTP server on my router, then when sending an email I could choose what SMTP server to use:
- my SMTP server so that the email will be sent during the proper time window
- my ISP's SMPT server in order to sent the email instantly

The idea would be to have postfix filter all mail into the 'hold' queue.  A cronjob can then be used to run postsuper, which should be sufficient to move the mail from the 'hold' queue at the specified time(s), allowing the mail to then be sent.

I've not tried to set this up before, so I have no idea whether it will actually work.  I expect the biggest challenge to be working around the postfix documentation, which I've found to be a jumbled mess in the past...

Offline

#11 2010-01-07 11:13:13

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: Scheduling email sendings - any ideas?

I'm a bit reluctant to set up an SMTP server just for this task. I don't have any experience in this field, and I'm looking for something easy to set up.
My basic idea was:
- send any urgent email directly throught my ISP's SMTP (this is the current situation for all my outgoing emails)
- queue any other email on my gateway, and send them at night time. This probably means setting up an alternative SMTP server on my gateway...

msmtpqueue could do the job as long as it is installed on workstations. But this involves my workstations should be running at night time. This is far more energy efficient to centralize this task on my gateway (a 10-year old 600 MHz PC running Arch).
I haven't figured out a way to configure msmtp to catch (not urgent) outgoing emails on my gateway. Maybe it's just not possible...


what goes up must come down

Offline

#12 2010-01-07 20:36:26

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: Scheduling email sendings - any ideas?

Do you guys know about an SMTP server that's very light, easy to set up and supports queues?
I checked a few SMTP servers, but they seem to be horribly complicated...


what goes up must come down

Offline

Board footer

Powered by FluxBB