open new Outlook from website, too long mailTo Link, *.eml file bcc field not loaded
Asked Answered
B

3

7

I'm trying to open a *.eml file with Microsoft Outlook 2010 and got problems with the bcc field.

Here is my eml file:

To: [email protected]
Subject: Mail Subject
cc: [email protected]
bcc: [email protected]
Content-Type: text/plain
MIME-Version: 1.0
X-Unsent: 1

Mail content

When I open this eml file with Outlook all entries work fine, except bcc. How can i bring the bcc field to work?

Edit

I basicly want the same behavior of a mailto link on a webpage. The user should click on a link and the default mailprogram (which is Outlook in the office where the software is used) should open. mailto links work fine until the link is not longer than about 2000 characters. In my case, the informations that I need to pass to Outlook are much longer than 2000 characters, so I tried to generate an *.eml file which doesn't work as expected.

So what I need:

  • a link similar to a mailto link
  • must work with more than 2000 characters
  • must work in Google Chrome & Outlook 2010

What I got:

  • PHP
  • JavaScript with jQuery
Bodnar answered 19/11, 2013 at 16:35 Comment(1)
Browsers have limits on url lengthsMaiolica
B
2

I found a solution for my given problem.

MailTo links are still too long and *.eml files won't work. But it's possible to generate a *.vbs file (Visual Basic Script) which will open up a new Outlook E-Mail send form with all the fields I need and a very long Body (tested with over 50000 characters). Here is a sample code for such an *.vbs file:

'Create an Outlook application object 
Set objoutlookApp = CreateObject("Outlook.Application") 

'Create Message 
Set objmessage = objoutlookApp.CreateItem(olMailItem) 
objmessage.TO = "[email protected];[email protected]"
objmessage.CC = "[email protected];[email protected]"
objmessage.BCC = "[email protected]"
objmessage.Subject = "E-Mail Subject"
objmessage.Body = "Here comes some text, followed by a newLine" & vbNewLine _
& "and here is a second Line with some special characters like the paragraph: " & chr(167) & ", a german umlaut: " & chr(228) & " or some quotes: "". Hope this will help!"
objmessage.display

set objmessage = Nothing
set objoutlookApp = Nothing

wscript.quit
Bodnar answered 11/3, 2014 at 13:25 Comment(1)
This is very useful, until you realize you need UTF-8 supportOrnate
M
4

For your edit, you can use forms in this way:

<form name="mailform" action="mailto:[email protected]">
    <input type="hidden" name="bcc" value="[email protected]">
    <input type="hidden" name="Subject" value="Email subject">
    <input type="hidden" name="Body" value="A Big body ">
</form>
<a href="#" onclick="document.mailform.submit()">send email</a>

I used this on an Ubuntu machine, with Thunderbird and Gmail web as default mail client and Google Chrome and Firefox as browsers and both worked. I don't know about outlook, you need to test it for outlook yourself ;) But notice, generally mailto links depends on user's machine.

Majuscule answered 2/3, 2014 at 10:33 Comment(2)
Thank you for this idea, but it doesn't work for me. I get the same issue as I get when I use a long mailto link. In fact this form generates such a link using JavaScript and passes it to Outlook. I think Outlook is the problem here, not the Browser or the HTML / JS codeBodnar
mailto url schema is limited to ~2000 chars because of the GET restrictionGossip
B
2

I found a solution for my given problem.

MailTo links are still too long and *.eml files won't work. But it's possible to generate a *.vbs file (Visual Basic Script) which will open up a new Outlook E-Mail send form with all the fields I need and a very long Body (tested with over 50000 characters). Here is a sample code for such an *.vbs file:

'Create an Outlook application object 
Set objoutlookApp = CreateObject("Outlook.Application") 

'Create Message 
Set objmessage = objoutlookApp.CreateItem(olMailItem) 
objmessage.TO = "[email protected];[email protected]"
objmessage.CC = "[email protected];[email protected]"
objmessage.BCC = "[email protected]"
objmessage.Subject = "E-Mail Subject"
objmessage.Body = "Here comes some text, followed by a newLine" & vbNewLine _
& "and here is a second Line with some special characters like the paragraph: " & chr(167) & ", a german umlaut: " & chr(228) & " or some quotes: "". Hope this will help!"
objmessage.display

set objmessage = Nothing
set objoutlookApp = Nothing

wscript.quit
Bodnar answered 11/3, 2014 at 13:25 Comment(1)
This is very useful, until you realize you need UTF-8 supportOrnate
P
0

Your problem is probably outside of your eml file. I've tested your file on my OSX machine and the bcc is showing in the Mail app.

However: bcc is by default not shown in outlook so now you could have 2 situations:

  1. bcc is not shown, but might be set from your eml file, if this is not an issue: success!
  2. since bcc is not shown outlook might not set it. In that case you'd have to make it so that everyone enables bcc to be shown by default. (walk by all desktops, ask the adminstrator, ...) This might be a blocker if you are not allowed to require this change.
Propertius answered 27/2, 2014 at 11:0 Comment(2)
I already tried to set up the Outlook client on my desktop so that the bcc field is shown. But it's still empty after opening the eml file.Bodnar
Hmmm in that case it might be that there is just no solution. I've read about some implementations that do not save bcc headers, since they are meant to be hidden and would otherwise still be shown to all recipients. This might be a side-effect of something like that.Propertius

© 2022 - 2024 — McMap. All rights reserved.