Link to home
Start Free TrialLog in
Avatar of MarkSullivan000
MarkSullivan000

asked on

trying to concatenate string for sending email

hi guys,

here is the string that i am sending in my mail body, when i get the email i do not get the link i want. Any ideas?

mail.Body = "You have been invited to a group <a href='http://localhost:1744/Register.aspx?GroupID=" + grpID + ">Invitation</a>";
Avatar of Kamaraj Subramanian
Kamaraj Subramanian
Flag of Singapore image

use the content type as 'text/html'
Response.ContentType="text/plain";
Response.Write("This is text type");
Set MailFormat to a "1", which is HTML format. Then you can insert regular
HTML for formatting in your Body.
Avatar of MarkSullivan000
MarkSullivan000

ASKER

Hi itkamaraj, Im not fimiliar with context type , can please show me how to use it ?

This is my email code currently
MailMessage mail = new MailMessage();

                        mail.From = new MailAddress("sully000000@gmail.com");

                        mail.To.Add(mailaddress); 
     
                        mail.Subject = "Invitation to GroupBookings-Inc.com";

                       
                        mail.Body = "You have been invited to a group <a href='http://localhost:1744/Register.aspx?GroupID=" + grpID + ">Invitation</a>";
                     
                        
                       
                        SmtpClient smtp = new SmtpClient();

                        smtp.Host = ConfigurationManager.AppSettings["SMTP"];

                        smtp.EnableSsl = true;

                        smtp.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]);

                        smtp.Send(mail);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of strickdd
strickdd
Flag of United States of America 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
To set the format of the email body,do this:
mail.IsBodyHtml = true;
thanks