Kontakt formular fungerer local men ikke ved upload
Jeg har lavet en lille kontaktt formular, som sender mailen hvis jeg blot kører den localt fra Visual studio, men ligeså snart jeg uploader den via FTP, og går ind via mit domæne fungerer den ikke.Er der eventuelt nogle der kan komme med en forklaring på dettte problem.
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
//Create the msg object to be sent
MailMessage msg = new MailMessage();
//Add your email address to the recipients
msg.To.Add("itsupporting@securehome.nu");
//Configure the address we are sending the mail from
MailAddress address = new MailAddress("itsupporting@securehome.nu");
msg.From = address;
//Append their name in the beginning of the subject
msg.Subject = txtName.Text + " : " + ddlSubject.Text;
msg.Body = txtMessage.Text;
//Configure an SmtpClient to send the mail.
SmtpClient client = new SmtpClient("asmtp.unoeuro.com", 587);
client.EnableSsl = false; //only enable this if your provider requires it
//Setup credentials to login to our sender email address ("UserName", "Password")
NetworkCredential credentials = new NetworkCredential("itsupporting@securehome.nu", "kodentilminmail");
client.Credentials = credentials;
//Send the msg
client.Send(msg);
//Display some feedback to the user to let them know it was sent
lblResult.Text = "Your message was sent!";
//Clear the form
txtName.Text = "";
txtMessage.Text = "";
}
catch
{
//If the message failed at some point, let the user know
lblResult.Text = "Your message failed to send, please try again.";
}
}
}