Hi everyone, I'm newbie on ASP.net and I was trying to to an application to send emails with the following code using System.net.mail namespace:
PrivateSub Envio_Correo(ByVal rutaAsString)'Creando la instancia del mensajeDim correoAsMailMessage = nothingcorreo.From =
New MailAddress("b98123839@dotnet.itags.org.usmp.edu.pe")correo.To.Add(
"amonasiq@dotnet.itags.org.usmp.edu.pe")correo.Subject =
"Archivo de Confirmación de matricula"correo.Body =
"Se adjunto archivo de confirmación de matricula de su respectiva facultad"correo.IsBodyHtml =
False'correo.Attachments.Add(New Attachment(ruta))correo.Priority = MailPriority.Normal
'Crando la instancia del SMTP clienteDim smtpAsNew SmtpClientsmtp.Host =
"192.168.1.53"Trysmtp.Send(correo)
Catch exAs SmtpExceptionlMenErr.Text =
"Paso 4: Enviando el correo: " + ex.Message.ToString()lMenErr.ForeColor = System.Drawing.Color.Red
EndTryEndSubBut always get the same error: Mailbox unavailable. The server response was: Error: Message content rejected
But if i use the namespace system.web.mail with almost the same code:
PrivateSub enviar_correo_antiguo(ByVal rutaAsString,ByVal facuAsString)Dim correoAsNew MailMessageDim adjuntoAsNew MailAttachment(ruta)
correo.From =
"desarrollo@dotnet.itags.org.usmp.edu.pe"correo.To = Devolver_mail_ora(facu)
correo.Subject =
"Archivo de Confirmación de matricula"correo.Body =
"Se adjunto archivo de confirmación de matricula de su respectiva facultad"correo.Attachments.Add(adjunto)
SmtpMail.SmtpServer =
"192.168.1.53"TrySmtpMail.Send(correo)
Catch exAs ExceptionlMenErr.Text =
"Paso 5: Enviando el correo: " + ex.Message.ToString()lMenErr.ForeColor = System.Drawing.Color.Red
EndTryEndSubI dont have any problem at all, Could anyone tell me what is wrong in my code?
Sincerly
Kryor
system.web.mail = asp.net version 1.1system.net.mail= asp.net version 2.0
I know system.web is for framework 1.1 and system.net is for 2.0 but why is working with the old namespace and not with the new one being almost the same code.
each website can only run 1 framework- even if both are installed.
It seems your website is configured to run framework 1.1 ( thats my guess, based on what you posted )
There is a tab in IIS where you set the version for each website.
System.NET is through sockets so you may have to add more code. Try the link below for more about System.NET.Mail. Hope this helps.
http://www.systemnetmail.com/
0 comments:
Post a Comment