Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jul 12, 2009 11:00 pm   

Adding colors question...
 
I use a script that emails notes to me posted on any board in Aardwolf. Script works wonderfully (except for the occasional 'Transport send' (or whatever) failure), but I'm wondering if there is a way I can add color to the emails based on what's posted.

For instance, if someone posts:
This is a post with color.

all I get is:

This is a post with color.

The way the script works is for the lines it receives in the note, it stores it into a variable, then uses COM object to send whatever is in the variable to me. It seems like it'd be something simple, though it's probably a lot harder than I think. However, any help would be greatly appreciated!

Charneus
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Jul 13, 2009 1:55 pm   
 
Well, first of all, in order for it to send you email in color, it will have to be more than plain text email. I don't know offhand what changes you'd have to make to the email header; it's been almost twenty years since I played with the mail protocol. But it would require some extra header fields specifying a MIME type, and formatting your message into that MIME type.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Jul 13, 2009 2:17 pm   
 
Lovely. Given my limited knowledge about COM objects in the first place, I wouldn't even know where to begin, and that really sucks. The reason for this is because sometimes the notes just don't make sense without color in it.

If there is an easier way to do it, that'd be great. If not, well, I'll have to deal with it, I guess. If someone knows exactly how to do it but needs the script, send me a PM and I'll let you look over it.

Greatly appreciated!

Charneus
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Thu Jul 16, 2009 7:37 pm   
 
You need to convert the text into html, in my opinion the hardest part of your problem and then as part of your com mail object more than likely called msg you just need to do msg.HTMLBody = strHTML as opposed to msg.Body = strBody
_________________
Taz :)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Jul 16, 2009 11:50 pm   
 
Ah. Definitely can change the msg.Body part.

I think you're right about the conversion to html being the hardest part. There isn't a simple way to store the ansi colors in with the variable? I only have 16 colors to deal with, but really I don't want to write a number of triggers to convert the string to html. It'd be nice if at least #WRITE allowed an option to write a trigger with html colors. I guess I'll dig around to see what I can find, though. Thanks!

Charneus
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Jul 17, 2009 2:35 pm   
 
I think buried in one of my scripts I wrote code that converted ansi colors into HTML or what I considered the equivalent. I'll try and dig it up this weekend. Ping me on Monday if I don't post it by then.
_________________
Asati di tempari!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net