Jump to content

Help with formatting text in e-mail


Go to solution Solved by water,

Recommended Posts

Glad to be of service :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

  • Replies 48
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi again,

I've stuck again on a problem regarding the _OL_ItemRecipientAdd -function. If I e.g specify "technical.support@company.com" in the code, the mail gets sent to just "support", i plain text.

What I think happens is that Outlook recognizes the e-mail adress as one of my contacts and converts it to the short-format "support" which happens usually when I type adresses manually. However in this case the adress is written in plain text, not html/richtext or w/e where the full adress is embedded in the shorthand version of the adress.

Not sure if I explained this clearly, please ask if you need more info and thanks again on beforehand! :)

Link to comment
Share on other sites

Function _OL_ItemRecipientAdd calls the "Resolve" method like Outlook does when you manually enter a recipient.

Do you mean that the SMTP address is resolved to the wrong recipient?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Hm well, not necessarily the wrong recipient, just in the wrong format so that it becomes unusable (plain text). 

Say I type "jim.harper@company.com" in outlook, then Outlook corrects it to "Jim Harperwith a small box in front of the name a.k.a in 'contact format', while mouse over a tooltip appears with the full e-mail address.

When the script adds the recipient it just says "Jim Harper" in plain text, no box in front of the contact and not in underlined 'contact text'. 

Here's the best image I could find of the 'contact format':

http://www.google.no/imgres?um=1&sa=N&hl=en&biw=1920&bih=1115&tbm=isch&tbnid=hO3gzvPRZADy8M:&imgrefurl=http://blogs.office.com/b/microsoft-outlook/archive/2012/03/23/5-tips-on-using-bcc-in-outlook-.aspx&docid=FGhFM1Z0pveg2M&imgurl=http://blogs.office.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-00-55/1440.BCC-screenshot-4.jpg&w=550&h=175&ei=_iUbUuiDIIT54QT2zoC4Cw&zoom=1&ved=1t:3588,r:63,s:0,i:275&iact=rc&page=2&tbnh=112&tbnw=354&start=34&ndsp=42&tx=206&ty=42

Again, what the script does is just entering "Jim Harper" as recipient in text, if you write it in plain text you'll have to type the address fully: jim.harper@company.com

edit: this is even though I specify jim.harper@company.com in the script, it still appears as just "Jim Harper" in plain text.

edit 2: maybe I mean there is no SMTP connected to the name since it's just a printed name (not sure how SMTP adresses work).

Edited by sackjarrow
Link to comment
Share on other sites

Did I ask you which Outlook version you use?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

I use 2010.

edit: more specifically Microsoft Office Professional Plus 2010

Outlook version:

14.0.6112.500 (32-bit)

edit 2: quoting your OutlookEX.au3:

"$vP1              - Recipient to add to the item. Either a recipient object or the recipients name to be resolved"

Maybe I could try entering a recipient object instead of typing the name in the code. Not sure what a recipient object is though or how I would add one :)

Edited by sackjarrow
Link to comment
Share on other sites

Strange. We use Outlook 2010 too and I've never seen this boxes in front of a name.
 

Hm well, not necessarily the wrong recipient, just in the wrong format so that it becomes unusable (plain text).

What do you exactly mean by "unusable"? Is the mail delivered to the correct recipient?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Oh something just struck me! No wonder you haven't seen the boxes they origin from other software I have installed called "Lync" which I guess is partly integrated with outlook then. I thought it was an Outlook function to convert text into contact when you typed them e.g if I type "jim.harper@company.com" Outlook converts it to just "Jim Harper", but just for display, the mail still gets sent to the full address.

If you haven't heard of Outlook abbreviating emailaddresses into names before maybe it isn't an outlook function?

edit: I now know the boxes originate from Lync, but still I feel quite confident Outlook abbreviates emailaddresses into names without Lync installed, just without the boxes.

edit 2: well when I press send a dialogue box appears with suggestions to whom I wish to send the mail (since you can't just send a mail to just text without an @ etc.), I then choose one of the suggestions and the mail is sent.

Edited by sackjarrow
Link to comment
Share on other sites

 

edit 2: well when I press send a dialogue box appears with suggestions to whom I wish to send the mail (since you can't just send a mail to just text without an @ etc.), I then choose one of the suggestions and the mail is sent.

This means that Outlook isn't able to resolve your input to a unique address.

Which version of the UDF do you use (this information is in the first few lines of the UDF)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

When you enter "jim harper" Outlook tries to resolve the recipient. This means it looks for a contact in your personal or a global address book.The address can be an Exchange address entry or (in your case) an SMTP address.

Enter a unique name in the "To" field - don't press Return - just move the mouse to the mail body and click. Wait a few seconds and Outlook will resolve the address and display it underlined.

If this does not happen then the address isn't unique and Outlook displays the selection dialog when you try to send the mail.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Yes this is exactly what I mean.

In my case the name is not unique, there are 2 contacts, hence the dialogue box as you say.

The underlying question though, is why doesn't the script put what I want it to put? In the script I have specified "jim.harper@company.com", yet it puts "jim harper" as recipient.

Link to comment
Share on other sites

Can you post the value of @error after you called _OL_ItemRecipientAdd?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

I'm a bit confused right now.

_OL_ItemRecipientAdd doesn't return an error. When you enter "jim.harper@company.com" Outlook resolves it to "jim harper" - this means the address is unique. But when you send the mail you get the recipient selection dialog (which means the address is not unique)?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Firstly I'm not sure if the @error is correct. Here's the code block so you can check if it's correct.

; >>> Here you have to extract the needed information from $aBodyForwarded and add it to $aBody <<<<
    _OL_ItemModify($oOl, $oForward, Default, "Body=" & _ArrayToString($aBody, @CRLF, 1)) ; Modify the new mail and set the body properly
    _OL_ItemRecipientAdd($oOl, $oForward, Default, $olTo, "jim.harper@company.com")
    MsgBox(1, "", @error)
    $oForward.Display
EndFunc   ;==>_ProcessItem

Secondly, to correctly illustrate the issue here let's change "jim harper" to "support". The address support@company.com is unique, although there are 2 contacts with "support" in their names. The first one is named "support" and the second one "test support"  as their names, although with different mail addresses, so again, "support@company.com" is unique.

Thirdly, yes apparently outlook resolves the address I specify in the script to "support". Here's the weird thing though, where I think there's something wrong. The resolved recipient name is just plain text, not underlined or in anyway connected to "support@company.com". i might aswell have typed in "fslkandfwq". No special contact or linked/underlined/special text, just plain. So when I then press send Outlook tries to match what is written (support) to some contact, and hence the dialogue box that appears.

Maybe it has something to do with that we set the mail to "plain text" or w/e we talked about in the beginning as compared to html or RTF format. Or was that just concerning the body of the mail?

edit: I'll have to go now, but I'll be back tomorrow.

Edited by sackjarrow
Link to comment
Share on other sites

Outlook resolves addresses based on the displayname and mail address.
A underlined recipient means that the address has been resolved.
"Ffsrhvfkc" should never get underlined as it is an invalid recipient.
Can you test on a machine without your add-on?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Outlook resolves addresses based on the displayname.

A underlined recipient means that the address has been resolved.

 

Since the displayname I'm sending to isn't unique I wonder why it resolves into something that is not underlined :)

Guess this probably has to do with Lync, Will test this on another machine when I get the time.

 

On a side note though I'm wondering about something completely different:

"$sP1      - Property to modify in the format: propertyname=propertyvalue"

I'm wondering about the $sP1 parameter in the _OL_ItemModify function. What are some examples of propertyname? Propertyvalue I guess could be almost anything, like a string or value/string derived from e.g a function?

I'm trying to also make the function colorcode the mail I forward using Outlooks categorizing (colorcoding) by color (boundable to e.g <ctrl> <F2> etc.).

Link to comment
Share on other sites

Properties you can modify can be found here.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Maybe it has something to do with that we set the mail to "plain text" or w/e we talked about in the beginning as compared to html or RTF format. Or was that just concerning the body of the mail?

"Plain text", "HTML" or "RTF" is only being used for the body of the mail.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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...