Solved

Email send as HTML Format but received as text.

Posted on 2010-11-24
13
633 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
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 …

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now