Solved

Attached html document automaticly opens in the body of the email I send from VB.Net page.

Posted on 2007-12-06
6
334 Views
Last Modified: 2013-12-18
I send form information as a generated html attachment on an email, but when sending to clients using Lotus Notes (ver. 7.02) the attached html document is opened as part of the email body.

This does not happen in Outlook or Hotmail.

Now other, older ASP applications in the same environment send emails with HTML attachments by saving them on the server and then attaching them, so it might have something to do with the way the attachment is made with the StreamWriter, but I fail to see how that should affect the final result of the mail.

The HTML document has <!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""> which I tried to change to HTML 4.0 to see if that made a difference, but it didn't.

I tried (as you will see in the code snippet) to send the body as plain text, hoping that it wouldn't attempt to blend them together, but to no avail.
Dim L_objEmailClient As New System.Net.Mail.MailMessage()
 
L_objEmailClient.Body = body.ToString()
L_objEmailClient.IsBodyHtml = False
 
Dim L_data As Byte() = Encoding.ASCII.GetBytes(attachment.ToString)
Dim L_MemoryStream As New System.IO.MemoryStream(L_data)
 
Dim L_StreamWriter As New System.IO.StreamWriter(L_MemoryStream)
 
Dim mail_Attachment As New System.Net.Mail.Attachment(L_MemoryStream, "registration.html", System.Net.Mime.MediaTypeNames.Text.Html)
 
L_objEmailClient.Attachments.Add(mail_Attachment)
 
smtpClient.Send(L_objEmailClient)

Open in new window

0
Comment
Question by:ihiwebdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 20419965
Lotus Notes always displays file attachments inline with the body of th email.  There are no other options.
0
 

Author Comment

by:ihiwebdev
ID: 20420022
Thats not true.
Usually it will stick the attachment icon somewhere in the body of the HTML, but here the problem is that it displays the HTML from the attached document inline with the mail content.

As I said several of the old ASP solutions manage to send emails to the notes clients with a html file attached with no such problems.
If I send these to myself and forward it to the client, the attachment shows up as an attachment, and not as content of the email body.

Apparently the change of headerinformation when it passes through my Outlook is sufficient to get Notes to handle it properly.

What I don't know if how to control that headerinformation to make Notes swallow it directly from the application.
0
 

Author Comment

by:ihiwebdev
ID: 20447948
Anyone?
0
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 500 total points
ID: 20449354
I've never used System.Net.Mail.MailMessage, so I'm not sure what options are available, but the first thing I would try is to use MediaTypeNames.Application.Octet as the mime type.
0
 

Author Comment

by:ihiwebdev
ID: 20470813
That worked! Awesome, thank you Bill. =)
0
 

Author Closing Comment

by:ihiwebdev
ID: 31413138
Thank you very much. That bug has had bothered for a while putting an ugly dent in an otherwise pretty project. =)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question