secman

Coloured text for e-mail

13 posts in this topic

I need to add some coloured text to an e-mail generated either by using iNetMail. or the OutlookEX UDF.

I need to change one line of text to green within the body of the e-mail to make that line stand out, then change back to black for the remainder of the message.

I have to add variables into the body of the text so don't want to use html (I don't really know how to create html pages) so how can I do it?

Thanks

 

Share this post


Link to post
Share on other sites



HTML would be the easiest way and should be possible with variables too.
Another possibility is to create RTF mails, but that is much more complex.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks for the response Water, I was expecting this would be the answer.

The problem is that I have absolutely no idea how to do this with HTML. I am a complete novice with HTML having never used it,

Are you aware of any wiki pages or help to get me started?

Once I have the basics I would then be able to ask if I need any help with the variables.

Thanks again

 

Share this post


Link to post
Share on other sites

This is a good starting point.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Simple HTML file with the second paragraph in green.

<!DOCTYPE html>
<html>
<body>
This is text in <b>bold</b>.
<p style="color:green">This paragraph is in green.</p>
<p>Normal text again.</p>
</body>
</html>

 

 

Edited by water
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Many thanks again Water.

You are the best!

Share this post


Link to post
Share on other sites

Thanks :)
If you like a solution you could press the "Like this" button.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi Water

I have built the html file and have all the colours working as I want.

I now need to add the variables.

As you can see from the attached code, the script send and e-mail following a password reset request so we simply add the e-mail address and users first name and the password as variables then sent these with the text body.

So the e-mail should look like :

to: fred@Hotmail.net

Subject: Password Reset

Message:

Dear "Fred"

New password is : "xxxxxxxxx"

.... then the html text file

I am having problems understanding how to get the html file read and used as the message, All I have been getting in the test e-mail is "Message.html". I need also to add the variables for Name and password to the message surrounded by some text.

Many thanks

 

MailMakerTest.au3

Share this post


Link to post
Share on other sites

I would create the HTML Mail file containing the whole message (including "Dear xxx ...").
Where you want to insert name and password use place holders %Firstname% and %Password%. The following script will replace them with the value of the corresponding variables.

Global $Name = InputBox("Name", "Enter the Person's Name")
Global $SLGPass = InputBox("Password", "Enter the New Password (6 Char Min)")
Global $sBody = FileRead(@ScriptDir & "\Mail.html") ; Read the whole file into a variable
$sBody = StringReplace($sBody, "%Firstname%", $Name) ; Replace place holder with Name
$sBody = StringReplace($sBody, "%Password%", $SLGPass) ; Replace place holder with Password
_OL_ItemModify($oOL, $oItem, Default, "HTMLBody=" & $sBody)

 

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks for the assistance Water, I have everything working as I wanted.

One question - I am displaying the message before it is sent but seem to have to close it manually (using the red X in the top corner) - is there a command to close the window if I don't want to send the item? - It closes OK if sent. 

Many thanks

Alan

Share this post


Link to post
Share on other sites

File -> Close?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It's OK - I have sorted it out.

Thanks again for all your assistance.

Alan

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now