Link to home
Start Free TrialLog in
Avatar of MadhuMenong
MadhuMenongFlag for India

asked on

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.
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you post the code you are using to send the message? Have you set the BodyFormat property of the MailMessage to MailFormat.Html?
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);
            }
        }
    }
}
ASKER CERTIFIED SOLUTION
Avatar of mr_nadger
mr_nadger
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of MadhuMenong

ASKER

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.
Avatar of Member_2_2459312
Member_2_2459312

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.
Also, mine is written in c#.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I apologize, you are correct, I over looked that.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot.