KickStarter15

[Solved] Add bold font in body text in email outlook

5 posts in this topic

#1 ·  Posted (edited)

Hi Experts,

I've searched in help and google on how to bold specific text in email body in outlook but the results are to bold all text in email body (which is not want I wanted). Is there a way we can have it like (i.e. "<b>Text</b>") in my code below? I've tried it but the mail received will have <b>Text</b> in the body.:(

$Body = "Dear All," & @CRLF & @CRLF & "Please see details below:" & @CRLF & @CRLF & "<b>Importance:</b>" & $aFormat & @CRLF & @CRLF & "<b>ErrorType:</b>" & $xFormat & @CRLF & @CRLF & @CRLF & "<b>Attached file: </b>" & "'" & GUICtrlRead($InputFile) & "'" & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & "Thank you!" & @CRLF & @UserName

Importance, ErrorType and Attached file must be set in bold font. Can this be done?

 

Thank you in advance.

KS15

Edited by KickStarter15

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hi Experts,

Found the cause why "<b>" bold is not generating in email outlook, its because of the below code:

If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
        $objEmail.HTMLbody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf

Because it is converted to plain text where outlook won't allow any emphasis. However, when changing it using HTMLbody for outlook, seems @CRLF won't work and all text will be run-on as one paragraph.

I tried using @CRLF, @CR, @LF, but these line breakers won't work as well and did also with "Break" but still not working.

Any idea guys?

Example:

I have my email body wanted as this:

Dear All,

BlahBlahBlahBlahBlahBlahBlahBlahBlahBlah.

Thank you,

@Username

But the output from the code above is this:

Dear All, BlahBlahBlahBlahBlahBlahBlahBlahBlahBlah. Thank you, @Username:o

 

Thanks,

KS15

Share this post


Link to post
Share on other sites

#3 ·  Posted

Found it Guys.:P

It's the "<BR>" function shall do the breaking.

 

Thanks

KS15

Share this post


Link to post
Share on other sites

#4 ·  Posted

Or <p></p> - Paragraph

Share this post


Link to post
Share on other sites

#5 ·  Posted

Or use Word as editor. How it works is explained in the _Ol_ItemCreate.au3 example of my OutlookEX UDF. 


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