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>";
Email ServersEmail ProtocolsC#

Avatar of undefined
Last Comment
MarkSullivan000

8/22/2022 - Mon
Kamaraj Subramanian

use the content type as 'text/html'
Kamaraj Subramanian

Response.ContentType="text/plain";
Response.Write("This is text type");
Kamaraj Subramanian

Set MailFormat to a "1", which is HTML format. Then you can insert regular
HTML for formatting in your Body.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Kamaraj Subramanian

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
strickdd

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jaya_banbah

To set the format of the email body,do this:
mail.IsBodyHtml = true;
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
MarkSullivan000

ASKER
thanks