Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Email send as HTML Format but received as text.

Posted on 2010-11-24
13
Medium Priority
?
642 Views
Last Modified: 2012-05-10
Dear Friends,

I am working on a Group discussion forum. The members are all registered members. On registration I send an email thanking for registration and a link to click and confirm their email id. This mail is send in html format but on testing with my gmail, hotmail, yahoo and rediffmail ids I found that the link is plain text and is not clickable.

using System.Web.Mail and not the lates System.Net.Mail.

Please advise.
0
Comment
Question by:MadhuMenong
[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
  • 3
  • 3
  • 2
  • +4
13 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34203826
Can you post the code you are using to send the message? Have you set the BodyFormat property of the MailMessage to MailFormat.Html?
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 34203855
hi


example  :

using System;
using System.Web.Mail;

namespace WebMail
{
    class Class1
    {
        static void Main(string[] args)
        {
            try
            {
                MailMessage oMsg = new MailMessage();
                // TODO: Replace with sender e-mail address.
                oMsg.From = "sender@somewhere.com";
                // TODO: Replace with recipient e-mail address.
                oMsg.To = "recipient@somewhere.com";
                oMsg.Subject = "Send Using Web Mail";
               
                // SEND IN HTML FORMAT (comment this line to send plain text).
               
oMsg.BodyFormat = MailFormat.Html;
               
                // HTML Body (remove HTML tags for plain text).
                oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>";
               
                // ADD AN ATTACHMENT.
                // TODO: Replace with path to attachment.
                String sFile = @"C:\temp\Hello.txt";  
                MailAttachment oAttch = new MailAttachment(sFile, MailEncoding.Base64);
 
                oMsg.Attachments.Add(oAttch);

                // TODO: Replace with the name of your remote SMTP server.
                SmtpMail.SmtpServer = "MySMTPServer";
                SmtpMail.Send(oMsg);

                oMsg = null;
                oAttch = null;
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
        }
    }
}
0
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 34203859
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Accepted Solution

by:
mr_nadger earned 1332 total points
ID: 34204850
try oMsg.IsBodyHtml = True;
(that's from a VB app I've written, C# may be a little different, but there is a property for forcing it to use HTML format)
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 34205054
Before send the mail using code just create Email body and copy it to file and view it in browser. By way you can find what problem you are facing.
0
 

Author Comment

by:MadhuMenong
ID: 34210739
Sorry friends for not responding. Currently I am working on an other issue and will come back to this by evening.
Please bear with me.
Thank you.
0
 
LVL 3

Expert Comment

by:DaveKeyes
ID: 34211902
The solution from mr Nadger is correct, this is how I do it in a common method I wrote.  It comes across as a HTML formatted email.
0
 
LVL 3

Expert Comment

by:DaveKeyes
ID: 34211905
Also, mine is written in c#.
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 668 total points
ID: 34211922
@DaveKeyes

The solution by Mr Nadger is NOT correct since he is using the MailMessage out of the System.Net.Mail namespace, whereas the question clearly states that the asker is using the older System.Web.Mail namespace.
0
 
LVL 3

Expert Comment

by:DaveKeyes
ID: 34211974
I apologize, you are correct, I over looked that.
0
 
LVL 7

Assisted Solution

by:mr_nadger
mr_nadger earned 1332 total points
ID: 34211976
oops missed that, should it be newmail.BodyFormat = MailFormat.Html?
0
 
LVL 7

Expert Comment

by:mr_nadger
ID: 34212002
0
 

Author Closing Comment

by:MadhuMenong
ID: 34215375
Thanks a lot.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

660 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