prob4567 Posted September 6, 2012 Share Posted September 6, 2012 BHHi, 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();}}} Quote Link to comment Share on other sites More sharing options...
Shinryuu Posted September 6, 2012 Share Posted September 6, 2012 The code is sound, and it works on NS you said, I have this strong suspicion that changing: mailClient.EnableSsl = true; to: mailClient.EnableSsl = false; will be the magic solution. Quote Link to comment Share on other sites More sharing options...
prob4567 Posted September 6, 2012 Author Share Posted September 6, 2012 BH.Hi Shynryuu, thanks so much for your reply. I've tried changing the enableSsl = false, but in that case i get an exception that something like "must issue starttls command first". Any other suggestions?ThanksAron Quote Link to comment Share on other sites More sharing options...
Shinryuu Posted September 7, 2012 Share Posted September 7, 2012 I think you should switch the port number to 587, if that doesn't help I'm not really sure what does, that seems to be a common error with no clear-cut solution. In the event it still gives an error, check your MX records and if those are good I'll just try to write up a slightly easier alternative. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.