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
Solved

Email send as HTML Format but received as text.

Posted on 2010-11-24
13
635 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
  • 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
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.

 
LVL 7

Accepted Solution

by:
mr_nadger earned 333 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 167 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 333 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: 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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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