QBall777
08-07-2008, 01:18 PM
Hi
I have a registration form that a user enters their details and then their details gets delivered to the website administrator, this all works fine. I now need the user to receive an automatic email reply in the form of a html template. Does anyone have any ideas??
This is my Code for the email to be sent to the administrator
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
string body = "Registration for some Registration website\n\n";
body += "Name: " + txtName.Text + "\n";
body += "Company Name: " + txtCompany.Text + "\n";
body += "Email: " + txtEmail.Text + "\n";
// send the mail
MailMessage msg = new MailMessage();
msg.IsBodyHtml = false;
msg.From = new MailAddress(txtEmail.Text, txtName.Text);
msg.To.Add(new MailAddress("administrator@website.co.uk"));
//if (!string.IsNullOrEmpty(Globals.Settings.ContactForm.MailCC))
// msg.CC.Add(new MailAddress(Globals.Settings.ContactForm.MailCC));
msg.Subject = "some Registration";
msg.Body = body;
new SmtpClient().Send(msg);
// show a confirmation message, and reset the fields
lblFeedbackOK.Visible = true;
lblFeedbackKO.Visible = false;
btnSubmit.Enabled = false;
}
catch (Exception)
{
lblFeedbackOK.Visible = false;
lblFeedbackKO.Visible = true;
}
}
My email template is called RegistrationMail.html
Thanks
I have a registration form that a user enters their details and then their details gets delivered to the website administrator, this all works fine. I now need the user to receive an automatic email reply in the form of a html template. Does anyone have any ideas??
This is my Code for the email to be sent to the administrator
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
string body = "Registration for some Registration website\n\n";
body += "Name: " + txtName.Text + "\n";
body += "Company Name: " + txtCompany.Text + "\n";
body += "Email: " + txtEmail.Text + "\n";
// send the mail
MailMessage msg = new MailMessage();
msg.IsBodyHtml = false;
msg.From = new MailAddress(txtEmail.Text, txtName.Text);
msg.To.Add(new MailAddress("administrator@website.co.uk"));
//if (!string.IsNullOrEmpty(Globals.Settings.ContactForm.MailCC))
// msg.CC.Add(new MailAddress(Globals.Settings.ContactForm.MailCC));
msg.Subject = "some Registration";
msg.Body = body;
new SmtpClient().Send(msg);
// show a confirmation message, and reset the fields
lblFeedbackOK.Visible = true;
lblFeedbackKO.Visible = false;
btnSubmit.Enabled = false;
}
catch (Exception)
{
lblFeedbackOK.Visible = false;
lblFeedbackKO.Visible = true;
}
}
My email template is called RegistrationMail.html
Thanks