Log emails sent outside of normal methods

dan

Verified User
Joined
Jan 2, 2007
Messages
98
Location
North Wales, UK
So, I'm in the middle of writing an application for a client, and there's a requirement to use a mass-mailing service. We've settled on Amazon SES, but is there anything in DA I can use to log a number of emails sent at a specific time, and how many were sent?

For example, when the software sends a bulk mail out to 2000 addresses via SES (HTTP API call), is there's something I can use to tell DA that it's sent 2000 emails at xKb a piece? So that I can add this to the account's tally and get more accurate monthly billing? As the SES account is used for multiple clients, this seems to be the only logical way I can think of to separate out clients email sending in the same account. It'd be nice if it'd tie right into DA's tally system!

Thanks,

Dan
 
Nooo. This is a completely legitimate newsletter mailing platform for our clients (Beauty Salons/Hair Studios/etc) to send news and promotion newsletters to their clients. The mailing lists are opted-in via a double-opt-in process, or with offline confirmation (they have like "Sign up to our mailing list" cards on reception desks for customers to write their email addresses on, which are inputted manually at a later date).

There's nothing malicious involved within the software. It's actually against the platform's Terms of Service to our clients to use the platform for spamming purposes. It's also against Amazon's Terms of Service Agreement to be using SES for spam (and they lay the law down really hard when it comes to this. They're really strict).

I'm after this logging in DA for 2 purposes. One so that my client (who I'm writing the platform for) can see how many emails they've shifted that month, and two so that I can bill them accordingly. As I will end up having many of my clients using the same Amazon SES account, it allows me to split up the total bill from Amazon into each individual account. This info would also come in useful in the future when I'm building e-commerce platforms (Magento) to other clients, who may want to use the built in newsletter platform, which I'd build and log/bill in exactly the same way. Since none of the emails from any of these platforms would be passed through exim, DA would otherwise have no way of knowing that these accounts sent any emails at all. And if I'm billing on a pay-as-you-go model, I have no figures to bill against!
 
Ohh, I see. I guess you should write a script, which would with root privileges update the following files:

/etc/virtual/usage/username
Its size denotes the number of sent emails per day. The file consists of digit 1. So many 1s you have there, so many bytes the size of the file is, and that's how many letters were sent by an user during the day. It will be truncated on tally by directadmin.

/etc/virtual/usage/username.bytes
This file contains size of all sent and received messages during the day with their message-id and other information, e.g.:

Code:
33856=type=email&[email protected]&method=incoming&id=1S7i1t-00058A-BQ&path=
987=type=email&[email protected]&method=outgoing&id=1S7i3E-0006KP-IS&path=/home/username/domains/domain.com/public_html
1460=type=email&[email protected]&method=incoming&id=&path=/
34204=type=email&[email protected]&method=incoming&id=&path=/
34316=type=email&[email protected]&method=incoming&id=&path=/
34317=type=email&[email protected]&method=incoming&id=&path=/
1460=type=email&[email protected]&method=incoming&id=&path=/
34316=type=email&[email protected]&method=incoming&id=&path=/
34317=type=email&[email protected]&method=incoming&id=&path=/
34204=type=email&[email protected]&method=incoming&id=&path=/
1313=type=email&[email protected]&method=incoming&id=1S7i6b-0007kR-VO&path=
33852=type=email&[email protected]&method=incoming&id=1S7i6b-0007kY-Vr&path=
33964=type=email&[email protected]&method=incoming&id=1S7i6b-0007ka-Vq&path=
33965=type=email&[email protected]&method=incoming&id=1S7i6b-0007kh-W4&path=

From this file directadmin gets information about traffic and size of sent and received messages.

So I guess it will help you to achieve the desired. Feel free to ask more question, if you have any.
 
Very helpful. Thanks!

My system's got the /etc/virtual/usage/username.bytes files, but not the /etc/virtual/usage/username file. I take it this means then that my system's not using the latter file to tally email count, and just using the .bytes file instead?
 
Replace the word username with the name of the user under which the site runs.

And another point: I'd recommend using double opt-in even for those cards people fill out; someone may either maliciously or accidentally write down an incorrect email address, or the person doing the transcribing could mistype it into your system.

And personally, I'd write my own system for keeping track of the emails, especially if you have a hook into the system that's sending them. That way you could have all the details you want. (I've got a lot of mailing list experience; years ago I used to run a mailing-list company.)

Jeff
 
Yea, I figured that much. Below is the contents of that directory:

Code:
root@illusion:/etc/virtual/usage# ls -la
total 16
drwxr-xr-x  2 mail mail 4096 2012-03-14 00:41 .
drwxr-xr-x 42 mail mail 4096 2012-03-14 12:02 ..
-rw-rw----  1 root mail 1513 2012-03-14 17:22 admin.bytes
-rw-rw----  1 root mail 3591 2012-03-14 17:18 dan.bytes

As you can see, the "dan" file does not exist, but "dan.bytes" does, which doesn't quite go in line with zeiter's instructions. I was just wondering if this is normal/expected?

Thanks for your suggestion about the double-opt-in too. I'll most likely put that into the system as well. It already has an unsubscribe tracking system, plus bounce and complaint monitoring (which Amazon SES provides to you), which blacklists the address so it never sends anything to that address ever again.

Dan
 
I'm only guessing here but maybe it doesn't know of any sent emails? If you haven't sent any emails through the system yet it's possible the file isn't created yet? Hopefully user zEitEr will post again to respond.

Jeff
 
As you can see, the "dan" file does not exist, but "dan.bytes" does, which doesn't quite go in line with zeiter's instructions. I was just wondering if this is normal/expected?

Yes, that's OK, if you don not send email via exim, since /etc/virtual/usage/username counts only outgoing email, but not incoming. And /etc/virtual/usage/username.bytes has got both directions.
 
Back
Top