Search the Community
Showing results for tags 'coding c\# email form'.
-
BH Hi, i've wrote a code to send email through the website. It works fine in Network Solutions hosting, but not in heliohost.org. My code is below. The form is located at http://www.crystalclear.heliohost.org/contactus.aspx. What could be causing it? Thanks so much. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Mail; namespace WebApplication5 { public partial class contactus : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string bodystring = "Name: " + TextBox1.Text + " Email: " + TextBox2.Text + " Message: " + TextBox3.Text; SendMail(TextBox2.Text, bodystring); Response.Redirect( "thankyou.aspx"); Response.Flush(); } private void SendMail(string from, string body) { MailMessage message = new MailMessage("myemail@hotmail.com", "sendtoemail@hotmail.com", "Contact From Website", body); SmtpClient mailClient = new SmtpClient("smtp.live.com", 25); System.Net. NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("myemail@hotmail.com", "mypassword"); mailClient.DeliveryMethod = System.Net.Mail. SmtpDeliveryMethod.Network; mailClient.UseDefaultCredentials = false; mailClient.EnableSsl = true; mailClient.Credentials = SMTPUserInfo; mailClient.Send(message); message.Dispose(); } } }