I am attempting to create a VBA Macro that will automatically send emails based on attributes within my spreadsheet - within each email is HTML code with <a href ="mailto:...> hyperlinks. The cc and bcc fields in those hyperlinks are dynamic as well.
I create the HTML code for the hyperlinks within the excel spreadsheet itself by using Concatenate to create the following values:
send email
In order to test that it works, I display the olmailitem before sending. All of my hyperlinks work perfectly when the olmailitem is displayed. However, when I send the email to myself to test it from my Outlook, one of the hyperlinks fails to open. There is no error message - it just does not open.
The one difference between the mailto hyperlink that does not work and the others is that there are around 70 emails that are BCC'ed in the html. The length of this mailto hyperlink is 1683 characters.
I think that my issue is that there is a maximum length to a URL that outlook can handle from its desktop application. However, I don't know what that length is. Does anyone have insight?
Related
I tried two options for mail merge but I am not able to retain the formatting.
I don't want to save the email content in the HTML file of the code because I want it to be easy to update the email template for someone who does not know coding.
Using the regular mail merge code from google apps script where email content is stored in a cell of the sheet. But I want this content to be formatted - bullets, urls, bold etc.
Reference: https://developers.google.com/apps-script/articles/mail_merge
(Most effective so far) Using advanced version of regular mail merge but the variables cannot be formatted.
Refernce: https://developers.google.com/gsuite/solutions/mail-merge
Using a google doc template which has variables that will be filled from spreadsheet using a script. Then this content needs to be emailed without the formatting being lost. I am able to set the variables and send personalized emails, but the formatting (bold, bulleted list, new lines, urls) is being lost. How do I retain the formatting?
Reference : https://katydecorah.com/code/google-sheets-to-gmail-template/
Sample Doc Template
Hello {Name},
Here is your confirmation number {Number}.
Please bring the following items.
List item
List item
Please visit this website www.google.com for more details
My web application sends emails to subscribed users.
The email is formatted as an html page and contains html addresses specified as plain text (not inside href tag).
The intent is for the email client to display the html address as simple text, one that the user can "paint" with the cursor and copy to clipboard
This works just fine in some email clients (for example yahoo). However,
other clients (for example, MS outlook and gmail) detect these pieces of text, and display the html address as a link, making it difficult for the user to do the paint-copy-paste described above.
I tried the following:
wrap the text in CDATA block - gmail then disregards the whole block
escape the html address (instead of http://... --> http://...) - makes no difference (still make a link out of text)
any ideas?
you could but a double :: to disable the parsing:
http:<span style="display: none;">:</span>//google.com/
This will not show the second : and should avoid the parsing.
EDIT:
This will work:
http<span>:</span>//google<span>.</span>com/
Please bear with me; there's a long story coming up. It's about programatically creating HTML e-mails from Delphi-7, sending them to Outlook, and not showing the pictures in it, so if you don't know anything about that, don't bother reading it all.
I have an application that sends variable-text E-mails, from a Delphi-7 program, to Outlook. I'm using a TMailInfo item, use a template HTML file for layout, replace placeholders with data from the program (%NAME% becomes "Johnson" etc), create a new Outlook message and populate HTMLbody with my result. All of this works fine.
Recently my client sent me a new sample message, asking me if I could change this E-mail to the new layout as he sent me. So I saved the E-mail as html (from Outlook, generating a huge HTML file full of code that is hardly understandable for a non-HTML guru like me)), replaced the static data with my placeholders, and saved it as the new template.
This worked fine except for one thing - the new layout included some local pictures (not available from a public web resource). When original sample mail from outlook, two things were created - a htm file with the html code, named "Subject" AND a folder called "Subject_files", containing the picture files plus a filelist.xml and an mso file.
The generated HTML refers to the pictures as src="subject_files/image001.jpg"> etc.
When I send the HTML to Outlook, it obviously has no idea where the images are - but how do I tell him?
What I tried:
copying the "subject_files" folder to "My Documents"
hardcoding the links to the pictures in several formats (i.e.
src="C:/test/subject_files/image001.jpg",
src="C://test/subject_files/image001.jpg",
src="C:\test\subject_files\image001.jpg",
and the like
but both don't work... so my question is really, how do I tell Outlook where to look for image files when programatically creating an HTML message?
Thanks in advance!
Once you the email, the recipient does not have access to your computer, So the images won't show in the email. to send images in an email you can:
Use aboslute links
<img src="http://www.example.com/images/header.jpg">
Use embedded images
Convert your images to BASE64, you can find many web sites online to that like
https://www.base64-image.de/ then
<img src="data:image/jpg;base64,/*base64-generated-string*/" />
As mentioned by Remy, the images can be added as regular attachments. You will then need to set the PR_ATTACH_CONTENT_ID property (DASL name http://schemas.microsoft.com/mapi/proptag/0x3712001F) using Attachment.PropertyAccessor.SetProperty. The HTML body must use the matching value for the cid attribute - <img src="cid:xyz">, where "xyz" is the value of the PR_ATTACH_CONTENT_ID property.
I'm trying to send an email with hyperlinks with "mailto", to email me back. I'm trying to automate the replies as they come in using mailitems in VBA, for example:
Dim Item As MailItem
Set oItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
For Each Item In oItems
etc. And searching for key words/IDs to indicate which link the sender has clicked, however the chance of the sender changing the subject or body of the email would be a spanner in that plan.
Is there a way that I can embed some hidden data (like an ID and yes/no response, for example) in the HTML of the mailto in order to properly identify the emailer, even if they change all the visible email data, and then what is the best way of accessing that data using code similiar to the above?
Is there a better way of doing this? Am I approaching this the wrong way? or am I totally barking up the wrong tree?
Thanks for your help!
You won't be able to pass an hidden data with a mailto, everything could be changed by the sender.
A better way of doing it is to make a little form in HTML & PHP (for example), with in your emails a link to this form passing the ID in the url, then retrieve this ID in your form, then saving this ID when the form is submitted.
You could also make links in your emails pointing to a redirection page saving the ID passed in parameter in the url then redirecting to the mailto: final 'link'. It would allow you to know who clicked on which link in your emails.
I have an email script written in .Net that sends html emails. The email uses normal html hyperlinks to insert a link in the email, like this:
StackOverflow
The problem is that in Entourage, a hyperlink like this always shows up for me like this:
StackOverflow < http://www.stackoverflow.com/ >
How can I format the hyperlink in my email so that in Entourage the text "StackOverflow" is the actual hyperlink, and the URL is not displayed after the text? Is there an html meta tag that needs to be set? Do I have to set the content-type somewhere? Or is there a different html syntax on the hyperlink itself that I should use?
In emails from some websites a hyperlink such as the one above renders correctly in Entourage, whereas in emails from others it does not. So, what is the difference between the emails sent from these different domains?
I suspect it is something in the meta information. Maybe the DomainKey-Signature?