EMail via SMTP mit Authentifizierung versenden

JohnDoe

Erfahrenes Mitglied
Hallo Leute,

seid heute versuche ich mich in ASP.net.
Ich habe mein erstes Formular fertig und es läuft so, wie ich es mir vorstelle.
Nur eins fehlt mir noch.
Und zwar möchte ich die eingetragenen Daten und das Ergebnis einer Berechnung via EMail versenden.
Auf dem Webserver ist allerdings kein SMTP-Server eingerichtet.
Wir haben aber bei der Telekom einen Relay mit Nutzername und Kennwort.
Nun habe ich gelesen, dass es in .net1.1 nur schwer möglich ist, eine Mail über SMTP mit Name/Kennwort zu versenden.
Ich habe im Internet folgenden Code gefunden und implementiert. Leider ohne Erfolg:
Code:
Imports System.Web.Mail
Public Class cls_mail
    Function send_to_customer()
        Dim MyMail As New MailMessage
        MyMail.To = "<Empfänger>"
        MyMail.From = "<Absender>"
        MyMail.Subject = "<Betreff>"
        MyMail.Body = "<Text>"
        MyMail.Fields.Add("http:/schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
        MyMail.Fields.Add("http:/schemas.microsoft.com/cdo/configuration/sendusername", "<Username>")
        MyMail.Fields.Add("http:/schemas.microsoft.com/cdo/configuration/sendpassword", "<Kennwort>")
        SmtpMail.SmtpServer = "<Mailserver-Adresse>"
        SmtpMail.Send(MyMail)
    End Function
End Class

Als Fehler wird ausgegeben, dass der Server eine Authentifizierung benötigt.
Ich habe mal zum Test einen dieser Links aufgerufen. Anscheinend führen diese URL's ins leere.
Könnte das der Fehler sein?
Gibt es noch eine Möglichkeit, eine Mail über SMTP Auth. zu versenden?
Danek für eure Tipps
 
Probier mal:
Code:
Dim message as new MailMessage;

message.From="from@from.com" 
message.To="to@to.com" 
message.Subject="ddddd"
message.BodyFormat = MailFormat.Text
message.Body="yyyyy"

message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver","smtp.mein_isp_smtp_server.com")
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",25)
message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",2)
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 )
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","username")
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","password")
System.Web.Mail.SmtpMail.SmtpServer = "smtp.mein_isp_smtp_server.com"
 
Danke für deine Hilfe,

aber leider scheint es nicht zu funktionieren.
Ich habe es jetzt mit unseren Daten bei mail.t-intra.de und mail.gmx.net versucht.
Leider bekomme ich keine EMail.
Aber ich kriege auch keine Fehlermeldung im Browser...

Code:
Imports System.Web.Mail
Public Class cls_mail
    Function send_to_customer()
        Dim message As New MailMessage

        message.From = "info@mail.com"
        message.To = "ich@mail.com"
        message.Subject = "test"
        message.BodyFormat = MailFormat.Text
        message.Body = "yyyyy"

        message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "mail.gmx.net")
        message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25)
        message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2)
        message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)
        message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "123456789")
        message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "PASSWORT")
        System.Web.Mail.SmtpMail.SmtpServer = "mail.gmx.net"
    End Function
End Class
 
Zurück