Invio mail con asp.net 2.0

giovedì 14 settembre 2006 - 12.01

sorbino Profilo | Newbie

Salve ragazzi ho un problemino per l'invio mail, per ora voglio vedere solo se le mail vengono inviate ed ho scritto il seguente codice:

protected void Button1_Click(object sender, EventArgs e)
{
MailMessage messaggio = new MailMessage();
messaggio.From = new MailAddress("indirizzomailmittente@mittente.it", "Davide");
messaggio.To.Add(new MailAddress("sorbinoweb@host.it"));
messaggio.Subject="Prova";
messaggio.Body="prova mail chissà se funge";
try
{
SmtpClient invio = new SmtpClient("smtp.host.it,25");
invio.Send(messaggio);
}
catch (Exception ex) {
Response.Write("Errore: " + ex);
}
}

mi esce il seguente errore:
Errore: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'smtp.host.it,25' at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.Button1_Click(Object sender, EventArgs e)



come host metto quello che ho aquistato su aruba.


___________________________________________________________________________________
ok funziona ho fatto io na cacchiata per distrazione
SmtpClient invio = new SmtpClient("smtp.host.it,25");
devo fare SmtpClient invio = new SmtpClient("smtp.host.it",25);

sorbino Profilo | Newbie

che può accadere se metto anche la porta????
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5