Jump to content

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


Recommended Posts

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

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

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

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Link to comment
Share on other sites

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...