Ciao a tutti!
Un buon inizio settimana a tutti voi!
Vi chiedo un aiuto, è tutto il fine settimana che sono sopra a questo problema...
Ho seguito una guida per creare un form di invio email con il nuovo sistema System.Net.Mail;
ecco il codice che ho scritto nella pagina contatti.aspx.cs
il problema ragazzi nasce nel parametrocodice:protected void btnSendmail_Click(object sender, EventArgs e) { // System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0 // System.Net.Mail.SmtpClient is the alternate class for this in 2.0 SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try { MailAddress fromAddress = new MailAddress(email.Text); // You can specify the host name or ipaddress of your server // Default in IIS will be localhost smtpClient.Host = "localhost"; //Default port will be 25 smtpClient.Port = 25; //From address will be given as a MailAddress Object message.From = fromAddress; // To address collection of MailAddress message.To.Add("email@email.it"); message.Subject = "Feedback"; //Body can be Html or text format //Specify true if it is html message message.IsBodyHtml = false; // Message body content message.Body = txtMessage.Value; // Send SMTP mail smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lblStatus.Text = "Send Email Failed." + ex.Message; } } }
smtpClient.Host = " ?? ";
e credo anche nel valore della porta: smtpClient.Port = 25;
quando cerco di inviare la mail nel server locale su win 7 nulla da fare , ma se almeno provo a uplodare la pagina sul server che ha come maintainer aruba, che parametri devo inserire per far si che funzioni? smtp.aruba.it non credo funzioni...
Se lascio il campo vuoto non sa a quale parametro smtp far riferimento...
vi ringrazio molto per l'aiuto!



Rispondi quotando
