c# sending email

Hi,

I am sending an email VIA c# in a string format like
body = "the email made up with html"

In here I have a link like so

http://thes.com/x.aspx?CompanyId=1&ImageID=1&EmailID=2\

But instead of hard coding the values for CompanyId, ImageID, and EmailID I want to pass the variables

sCompanyID, sImageID, sEmailID

Please help

Thanks

R8VI
R8VIAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tapan PattanaikSenior EngineerCommented:
0
R8VIAuthor Commented:
Hi

Thanks for this, the question is not about sending emails sorry its about how do I append the variables to the HTML string
0
Jerry MillerCommented:
C#
string companyID = "1";
string ImageID = "1";
string EmailsID = "2";

string urlString = "http://thes.com/x.aspx?" + companyID + ImageID + EmailID + "\\";

VB
Dim companyID as string = "1"
Dim ImageID as string = "1"
Dim EmailsID as string = "2"

Dim urlString as string =  "http://thes.com/x.aspx?" & CompanyId & ImageID & EmailID & "\"
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

guru_samiCommented:
You can use String.Format.
string formattedstring = String.Format("http://thes.com/x.aspx?CompanyId={0}&ImageID={1}&EmailID={2}",companyid,imageid,emailid);
//companyid, imageid and emailid above are the variables that hold the values

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jitendra PatilSr.Software EngineerCommented:
try the below code
C#
string companyID = "1";
string ImageID = "1";
string EmailsID = "2";
string url="http://thes.com/x.aspx?companyID="+companyID+"&ImageID="+ImageID+"&EmailID="+EmailsID+"\"

VB
Dim companyID as string = "1"
Dim ImageID as string = "1"
Dim EmailsID as string = "2"

Dim url as string = "http://thes.com/x.aspx?companyID="&CompanyId&"&ImageID="&ImageID&"&EmailID="EmailID& "\" .

hope this helps.
0
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
I would prefer ID 39533782 as best answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.