PDA

View Full Version : attaching a tag/sig to aliased email addys?


Monty
10-14-2002, 06:03 PM
I would like to attach a small "how to get in touch with me in case you don't want this email", to all emails sent through alias and alias stacks. Is there a way to do that?

Mont

~~~~my first complaints page went up today :)

skolnick
10-14-2002, 06:22 PM
How about a processor attached to the alias or stack that sticks the tag/signature on the end? Sprechen Sie Perl?

1. Slurp in the e-mail from stdin
2. Spit the e-mail back out stdout
3. Spit out the tagline
4. Clean up odds and ends (log or audit trail maybe?)
5. Return success code

sheila
10-14-2002, 06:29 PM
If I understand what Monty wants to do, it is to attach a sig/footer to outgoing mail.

The email scripting that is able to be set up on email accounts in the CNC is for processing incoming mail, not outgoing mail.

When sending outgoing mail, once it is in the mail queue, all the FutureQuest mail system will do with it, is to deliver it. In other words, if you want a sig file or footer attached to your message, you need to do that before injecting it for outbound delivery into the FutureQuest mail system.

This means, that the mail client must prepare the sig file or footer for you. The mail client could be your regular email program. Or, it could be some script on the FutureQuest site, such as a mail form and you post your messages from there.

However, it is not possible to set up a script in the CNC such that any message posted as coming FROM an email alias will have a sig/footer appended to it. Now, if you want it appended to incoming messages, that is quite simple. But, why would you insert a disclaimer on your own inbound mail?

skolnick
10-14-2002, 06:32 PM
Originally posted by Monty:
I would like to attach a small "how to get in touch with me in case you don't want this email", to all emails sent through alias and alias stacks.
Sheila's interpretation may reflect what Monty WANTS but what he SAID was sent through vice sent from. If in fact you (Monty) mean sent from then I agree with Sheila that it is a client issue.

Monty
10-14-2002, 07:34 PM
let me lay this out like it is really happening and maybe that will help.

I set up an alias stack to email key political/goverment players in the Texas Open Beaches struggle. Fisherman want to fish the beach, the big boys and their million dollar beachfront homes consider us a pita. They have the money to make life seriously miserable if they wanted to. We have the State of Texas Open Beaches act on our side. What comes to mind is that one of them considers the mail from openbeaches@mydomain.com spamming them, and they contact FQ. I get a copy of every mail that goes through this stack, and it's all just honest, regular citizens voicing opinions. Several of the recipients are making files of the mail they are getting for the public record. There's 2 more hearings/meetings before this deal gets decided. These files will likely be presented as part of testimony.

Since the email that this stack gets shows a to address of openbeaches@mydomain and the actual senders return email addy, I would like to add a tag inside there kinda like hotmail does, only referring complaint/requests to postmaster@mydomain so I can take them out of the stack or modify it comply with their wishes. This actually happened to me, one lady, not real nice about it, requested I use an alternate email. I complied with her wishes as quickly as I could, which is how I think things like this ought to be done.

What I want to do is provide recipients of any aliased email a complaints addy to work with, to enable me to get my chance to resolve it first if they have one. If an alias stack of this nature falls inside an problems that FQ has with it, I will take it down and do something else. I can also think of other uses for this tag, but mine is strictly as stated, ie "If you are the unwanted recipient of this email, please contact postmaster@mydomain for removal"

Mont

~~~saving the fishing is hard work, lol.

TVB
10-14-2002, 07:49 PM
Think about the mileage you could get from publicizing the fact that a public official doesn't want to hear about your issue from her contituents!

Sorry for the aside...I couldn't resist.

Betsy

sheila
10-14-2002, 07:56 PM
OK, Monty, this will do what you want.

Copy this code, and save it in the /big/dom/xdomain directory as addtag.py.

Make sure to transfer the file in text mode.
set permission on it to 755.
(edit the part in red as appropriate)

#!/usr/bin/python2

import sys

tagfile = "/big/dom/xdomain/tag.txt"

rawmail = sys.stdin.read()
tagtext = open(tagfile).read()
print rawmail
print tagtext


Then in a separate file, called tag.txt insert the disclaimer text you would like. As an example:


--
DISCLAIMER: If you don't want this,
please contact webmaster@example.com


Note that if you want any blank lines between the end of the original message and your disclaimer text, that you must insert that yourself in the text file for the tag. Save this file and upload it also to the /big/dom/xdomain directory as well. 644 permissions are sufficient.

Now, go to your CNC, Email Manager and click on the name of the alias stack where you would like to set up the filter. I guess, that would be openbeaches in this case (although you should try this out on a test stack first, just to make sure everything is set up correctly). This takes you to the mailbox properties page. Click on the "edit" link in the row for Custom Filters.

Scroll to the bottom of the screen. Find Filter 1.
From the drop-down menu, select "Processor" for the type of filter. In the adjacent box, enter the filter /big/dom/xdomain/addtag.py

save these settings. (edit red part as appropriate)

That should do it.

skolnick
10-14-2002, 08:45 PM
Ha!

1. I was right. <smug grin>
2. The Python Princess got to it before any of the Princes of Perl. <sigh>

Golly I love FQ! <grin>

Monty
10-14-2002, 09:25 PM
Once again, thanks for the help folks, and I will attempt to put Sheila's solution into play during tomorrow's business. It was raining here today, so I was stuck in the office and had a chance to completely tweak my new tos compliant email list to make it even more user friendly and imho, exceed tos requirements, which is good. I absolutely believe in giving folks an easy way to provide input, even if it's a complaint.

Betsy, I got personally contacted by the official in question, and there was absolutely no question her IT person helped shape her response. As a webmaster, and reseller, I listen and act on complaints. I just want to make it easier to complain to me directly and not take it upstream. That way, I get to handle it.

Mont

Andilinks
10-14-2002, 09:57 PM
Betsy, I got personally contacted by the official in question, and there was absolutely no question her IT person helped shape her response. And how would that response play if it were reproduced in the local press? I think Betsy has a point, there may be some leverage here to get it out of the realm of email... A sympathetic local reporter could spin it into the larger arena, where it belongs. Or at least that's how it looks from here.

Andi

Monty
10-14-2002, 11:20 PM
Andi, it's not so much the local reporter catching on the the whole story as it is them publishing that particular email address and I get SEVEN "slash dotted and spam copped" and an issue arises for one of the other domains on SEVEN. Not to mention, for the FutureQuest Staff. I don't want to be a bad neighbor or customer. I do *dearly* want my beaches kept open to the public, and so far this emailing has produced lots of attention, particularly from those that are out of state or inland and visit here to fish, spend money, and enjoy our beaches. Their input has been great, and eye opening. These beaches belong to all of us, not just the folks with the clout, slick laywers and bucks. This evening's fresh fish dinner was caught off a beach just to the south. Money and clout can't hold a candle to that.

Sheila, I did testing as advised and found that sending the email in RTF using the Outlook Express email client made the tag not work, but the email did go through. The same test email sent in plain text format resulted in it working perfectly. IRM email addresses worked in the same manner. I am not one to send RTF email, but I fear that puts me in a smaller group than most of my potential users. Thanks for any possible solutions and your help, as always. If this particular alias stack presents any issues to FutureQuest, please let me know here or in email.

Mont

tag.txt~~~~~

Please note that if you are the unwanted recipient of this email,
you are kindly asked to contact postmaster@mydomain.com for removal.

TVB
10-15-2002, 01:33 AM
Hey Monty,

Allow me for a moment to dig my journo hat from the closet (10+ years in local news and now freelance at the network level). The story isn't necessarily your email address nor the method in which you send or don't send. In fact, it isn't even germane to the story. The storyline/hook is the fact that you have an elected official asking her contituents not to contact her via her published email. In doing so, she has shut off what may be the most popular way for her constituants to have their voice heard. Your method is not unique and PACs and other constituant groups use this very same method all the time to make their voice and numbers heard. You don't need to reveal your email as the remainder of her constituents will make their voice heard through her published email that can be easily found anyplace. One caveat though: this is contigent that you were using a published email of hers and not a "private" one.

By contacting the local journos about her "shutting the gate", the story/hook will be her accessibility as an elected representative. The by-product will be at least local, maybe regional, maybe even bigger exposure to your quest. I have to admit that if I was still practicing the craft at the local level and was in Texas, I'd be smelling a pretty good story, especially with an election right around the corner.

Best,

Betsy

sheila
10-15-2002, 03:02 AM
Well, Monty, you sure are a tough customer. ;)

It is just a bit tougher to handle HTML, multipart/alternative, and other types of encoded messages.

But, being the sucker that I am for a mail script, I couldn't pass this one up (to the detriment of my other chores) :P

Anyhow, I've tested it a bit and seems to be working.

Follow the installation instructions as above, but be very careful in copying and pasting exactly as shown below. Python is a bit persnickity about spacing issues, and changing some of the spacing could cause potential problems.

Hope this works for you:

#!/usr/bin/python2

import sys
import mimetools
import multifile
from cStringIO import StringIO

tagfile = "tag.txt"

mailheaders = mimetools.Message(sys.stdin)
mailbody = sys.stdin.read()
tagtext = open(tagfile).read()

def insert_tag_in_html(textstring):
uppertext = textstring.upper()
tagindex = uppertext.find('</BODY>')
beforetag = textstring[:tagindex]
aftertag = textstring[tagindex:]
taghtml = tagtext.replace('\n', '<BR>')
taghtml = '<div><BR>%s</div>' % taghtml
return '%s%s%s' % (beforetag, taghtml, aftertag)

def parse_rewrite_multipart(textstring, mailheaders):
mailstream = StringIO(textstring)
boundary = mailheaders.getparam("boundary")
maildata = multifile.MultiFile(mailstream)
maildata.push(boundary)
mailbody = ""
while 1:
submsg = mimetools.Message(maildata)
subtype = submsg.gettype()
rawtext = maildata.read()
if subtype == "text/plain" and submsg.headers:
rawtext = "%s%s" % (rawtext, tagtext)
elif subtype == "text/html":
rawtext = insert_tag_in_html(rawtext)
elif subtype[:10] == "multipart/":
rawtext = parse_rewrite_multipart(rawtext, submsg)
mailbody = "%s\n%s\n%s\n--%s" % \
(mailbody, str(submsg), rawtext, boundary)
if not maildata.next():
break
mailbody = "%s--\n" % mailbody
return mailbody

contenttype = mailheaders.gettype()

if contenttype == "text/html":
mailbody = insert_tag_in_html(mailbody)
elif contenttype == "text/plain":
mailbody = "%s%s" % (mailbody, tagtext)
elif contenttype[:10] == "multipart/":
mailbody = parse_rewrite_multipart(mailbody, mailheaders)

print "%s\n%s" % (mailheaders, mailbody)



P.S. had to turn off smileys to get the code to show up properly...

spelling corrections...

Monty
10-15-2002, 08:48 AM
many thanks, Sheila! It works perfectly and I now believe my mailings will exceed tos requirements. Another scenario that had me concerned was someone replying to that email, and now they know who to contact if they wish to not get those emails.

Betsy, we are going to have a face to face meeting/hearing on that and this whole issue on the 22nd, and talk about the situation in person. She has supplied us with an contact email she wishes to be used, so in my mind, is trying to do the right thing. Her rather terse reply could have been her just having a hard day, not understanding where this mail was coming from, or some other problem. I am confident that the press will be in attendance, and as a side note, it stormed so hard at the last meeting the power went out, and the only lights we have were camera lights that the TV crews brought. It then proceeded to flood the streets and we had to move our cars. Hopefully, we will get some nice fall weather here for the next one and it can be a bit more productive. In between then and now, I just wanted those receiving the comments to have an established mechanism to get out of the loop if they liked.

Thanks again for all the help folks.

Mont

Monty
10-15-2002, 09:58 AM
Well, we made the front page of the paper this morning, so that's a good thing. http://galvnews.com If anyone is really interested in a balanced perspective read the letters to the editor and his article too. I read the paper while my 2nd grader and I wait on the big yellow bus, and hand't picked up the paper this morning prior to my earlier post.

In the past week, the attorney general’s office, the general land office and the city’s planning department have been swamped with emails written by angry beach goers.

That's the part of this deal I was concerned with since those emails are coming through FutureQuest and the ones I wanted to add this tag line to. I does appear I was correct about this putting some heat on these folks. I just wanted to be safe than sorry, and once again, thanks for the help.

Mont

TVB
10-17-2002, 02:24 PM
Hey Monty,

I stumbled on this article about emailing politicians in Roll Call (http://www.rollcall.com/pages/news/00/2002/09/news0916g.html) It makes some excellent points you may want to incorporate.

Betsy

Monty
10-17-2002, 06:01 PM
Betsy, that's the beauty of an alias stack for this, check out the screenshots

http://2coolfishing.com/fq/mail1.jpg

Notice the "from" is the actual senders address

and to keep me from getting complaints, check out the kewl thing Sheila's script does for me

http://2coolfishing.com/fq/mail2.jpg

and this is the actual text of email I send to addresses I wish to add to this alias stack that aren't on a goverment website

Hello,

Please forgive my intrusion into your busy day.

Each of your emails has been sent to me asking that they be added to the email list of openbeaches@2coolfishing.com
This list is seeking public comments on the proposal that the City of Galveston will be making in accordance with the Texas Open Beaches Act.

I adhere to the very strictest of spam policies and do not want anyone on that list that does not wish to be on it.
This policy is a "double opt in" spam prevention policy, the highest in the industry. In order for you to be added to it, please reply to this email giving your OK. If I don't hear back from you, or you don't reply, you will not be added to the list.

If you wish to be added to the list and later wish to be removed from it, instructions are included within each and every email sent to your address. Removal requests are promptly honored.

If you have any questions, please reply to this email with them or you may contact me at 281-332-9555

Thanks for you time, and this is the only email you will receive from me unless I hear back from you.

Monty Weeks

the subject line of these emails is "message from the postmaster@2coolfishing.com

Mont

nhajra
02-06-2003, 04:23 PM
VERY useful thread! I followed Sheila's instructions, and it seemed to work perfectly EXCEPT in one instance:

Using her 'advanced' python script (or whatever you want to call it :P ), I sent a message from Outlook 2000 in Rich Text Format to an alias (test@new.org), which then forwards the message to an EZMLM mailing list (test@mlm.new.org).

When I viewed the message through Questmail (i.e., browser-based email that shows plain text), the text footer showed up with NO problems (just as it did with plain text messages). However, when I received the SAME message to a different account through Outlook 2000, it was in Rich Text Format (no surprise there) and DID NOT DISPLAY THE FOOTER (surprise)! Does Outlook 2000 do something funky to these messages?

BTW, sending HTML-based messages did *not* result a loss of footer in Outlook 2000.Monty, I'm curious whether any of your recipients experienced this issue.

sheila
02-21-2003, 04:47 PM
Sorry for the delay in my reply to this latest question...it has taken me some time to get back to it.

For interested third parties: I asked Neel to subscribe me to his mailing list and send me some copies of emails which exhibited this problem and some that did not. So I got to look at an actual raw email that did not display the sig file, as desired.

The summary of this problem is, that when configured a certain way MS Outlook will create a Winmail.dat attachment, which is a proprietary data file and can be viewed only by other users of Outlook. I did a bit of research on this topic, hoping to find enough information to allow me to use a Python program to parse the file and be able to add a sig to the winmail.dat attachment. Here are some of the links which I found on this topic:

http://www.eudora.com/techsupport/kb/1552hq.html
http://www.modemhelp.net/newsletter/email/winmaildat.shtml
http://support.dataviz.com/support.srch?DocID=1309
http://www.brooklyn.com/theatre-sound/winmail.html
http://www.gpc.edu/~jbenson/resource/winmail.htm
http://support.microsoft.com/default.aspx?scid=KB;en-us;q241538
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/_mapi1book_tnef_processing.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/_mapi1book_tnef_stream_structure.asp
http://www.biblet.com/

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mapi/html/_mapi1book_transport_neutral_encapsulation_format_tnef_.asp
vBulletin breaks the above link, so I removed the special formatting from it. You will need to unwrap it if you copy/paste into your browser.

The short answer is, that it would not be possible to have a Python script that would do this. (I even posted a question to comp.lang.python asking for help on this issue, and it got no replies after more than a week, which is quite unusual for that newsgroup.) In fact, I doubt that it is possible for any server running an operating system other than Windows to do anything with the winmail.dat attachments.

Possible solutions to Neel's problem would include the following:

(1) Educate your subscribers to turn off the configuration in Outlook that sends the winmail.dat attachment. Some of the links listed above describe how to do that.
(2) Bounce back to the sender any messages which contain a winmail.dat attachment, with an informative error message explaining the problem and how to turn off this configuration. The script provided above (http://www.aota.net/forums/showthread.php?postid=75098#post75098) could be modified to do this.
(3) Have the script simply strip out, or remove, the winmail.dat attachment, leaving only the plain text version of the email to be distributed to the mailing list. This means that any formatting the original sender included in the message will be lost. I don't know how you feel about that. Again, it would be possible to have the script above modified to handle that case.
(4) Is there an alternative I did not think of?

I'd be interested in hearing your thoughts about the alternatives, Neel.

nhajra
03-24-2003, 09:39 AM
Thanks SO MUCH for exploring this issue - you've already solved the issue for the majority of the mailing list subscribers! With regard to the alternatives for those who use Outlooks:



>(1) Educate your subscribers to turn off the configuration in Outlook that sends the winmail.dat attachment. Some of the links listed above describe how to do that.

I think that's a bit too much to ask of users who send and receive just a few emails/month (at most) in connection with this list.

(2) Bounce back to the sender any messages which contain a winmail.dat attachment, with an informative error message explaining the problem and how to turn off this configuration. The script provided above could be modified to do this.

In the end, the same issue. It's important to me to keep the mailing list process as transparent as possible, so configuration on the user end is one step too far.

(3) Have the script simply strip out, or remove, the winmail.dat attachment, leaving only the plain text version of the email to be distributed to the mailing list. This means that any formatting the original sender included in the message will be lost. I don't know how you feel about that. Again, it would be possible to have the script above modified to handle that case.

This one is tempting, but I worry about the reaction of those who aren't prepared for the results ("Hey, all my bolds disappeared - it ruins the whole message!"). Even with up-front education, I think people forget over time.

(4) Is there an alternative I did not think of?

none that I can see. I think what I will do is just leave it in its current state (no taglines for Outlook rich text users). Based on traffic over the last month, there are plenty of people who don't have that issue, and therefore at least the message regarding unsubscribing and ownership get out to the subscribers one way or another.

Boy, I REALLY REALLY appreciate your help with this! I don't know what I would have done otherwise (probably find some other system to use). THANK YOU! :noddy:

mromero
09-04-2003, 06:28 PM
Would Sheila's script work to insert tags into outgoing email from regular mailboxes, i.e. not alias?

jansen
09-20-2003, 06:45 AM
Originally posted by sheila:
OK, Monty, this will do what you want.

Copy this code, and save it in the /big/dom/xdomain directory as addtag.py.

Make sure to transfer the file in text mode.
set permission on it to 755.
(edit the part in red as appropriate)

#!/usr/bin/python2

import sys

tagfile = "/big/dom/xdomain/tag.txt"

rawmail = sys.stdin.read()
tagtext = open(tagfile).read()
print rawmail
print tagtext


Then in a separate file, called tag.txt insert the disclaimer text you would like. As an example:


--
DISCLAIMER: If you don't want this,
please contact webmaster@example.com


Note that if you want any blank lines between the end of the original message and your disclaimer text, that you must insert that yourself in the text file for the tag. Save this file and upload it also to the /big/dom/xdomain directory as well. 644 permissions are sufficient.

Now, go to your CNC, Email Manager and click on the name of the alias stack where you would like to set up the filter. I guess, that would be openbeaches in this case (although you should try this out on a test stack first, just to make sure everything is set up correctly). This takes you to the mailbox properties page. Click on the "edit" link in the row for Custom Filters.

Scroll to the bottom of the screen. Find Filter 1.
From the drop-down menu, select "Processor" for the type of filter. In the adjacent box, enter the filter /big/dom/xdomain/addtag.py

save these settings. (edit red part as appropriate)

That should do it.


I would like to use this scripts. But I don't understand it very well. I don't know a CNC Email manager. I am using for my domain CPanel. And I have a cgi-bin directory; not a /big/dom/xdomain directory.

Please, can you help me?

Marco Jansen

Monty
09-20-2003, 09:14 AM
Marco, do you host here on FutureQuest? If you don't, you would need to set up an account here to do this first and then implement the scripts.
http://www.futurequest.net/Order/ is the place to get started.