Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 645
  • Last Modified:

Email send as HTML Format but received as text.

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
MadhuMenong
Asked:
MadhuMenong
  • 3
  • 3
  • 2
  • +4
3 Solutions
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
Kumaraswamy RCommented:
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
 
Dhanasekaran SengodanCommented:
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
mr_nadgerCommented:
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
 
Alpesh PatelAssistant ConsultantCommented:
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
 
MadhuMenongAuthor Commented:
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
 
DaveKeyesCommented:
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
 
DaveKeyesCommented:
Also, mine is written in c#.
0
 
Carl TawnSystems and Integration DeveloperCommented:
@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
 
DaveKeyesCommented:
I apologize, you are correct, I over looked that.
0
 
mr_nadgerCommented:
oops missed that, should it be newmail.BodyFormat = MailFormat.Html?
0
 
mr_nadgerCommented:
0
 
MadhuMenongAuthor Commented:
Thanks a lot.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now