SMTP (VB)
-
Ich habe folgenden Code geproggt es kommt kein Fehler es kommt aber auch keine Mail an:
Option Explicit Dim Buffer As String Sub WinsockReady() Do DoEvents Loop Until Buffer <> "" End Sub Sub Status(data As String) txtData.Text = txtData.Text & data & vbCrLf End Sub Sub SendData(data As String) Winsock.SendData data & vbCrLf Status "> " & data End Sub Private Sub Form_Load() Winsock.RemoteHost = "smtp.web.de" Winsock.RemotePort = 25 Winsock.Connect End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Winsock.Close Unload Me End Sub Private Sub txtData_Change() txtData.SelStart = Len(txtData.Text) End Sub Private Sub Winsock_Close() Status "<CONNECTION CLOSED>" End Sub Private Sub Winsock_Connect() Dim SendTo As String, SentFrom As String, Subject As String, MailBody As String SendTo = "X-Gangsta@web.de" SentFrom = "Sybillale@web.de" Subject = "test" MailBody = "test" Status "<CONNECTED>" SendData "HELO x.x" Call WinsockReady SendData "MAIL FROM: " & SentFrom Call WinsockReady SendData "RCPT TO: " & SendTo Call WinsockReady SendData "DATA" Call WinsockReady SendData "SUBJECT: " & Subject Call WinsockReady SendData MailBody SendData vbCrLf & vbCrLf & "." Call WinsockReady Winsock.Close Winsock_Close End Sub Private Sub Winsock_DataArrival(ByVal bytesTotal As Long) Winsock.GetData Buffer Status Buffer End Sub Private Sub Winsock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) Status "<WINSOCK ERROR> " & Number & ". " & Description & "." End Sub
-
Die WinsockReady() sollte die Server-Antwort besser mal auswerten.
(Mal ganz davon abgesehen das so gut wie kein Mailserver unauthentifiziert noch Mails annimmt (es sei denn es ist der Zielmailserver))
-
Und wie Veri ich es im Code und kann man den Code in C umformen?
-
http://de.wikipedia.org/wiki/SMTP-Auth
In WinAPI gibt es die Komponente (ein Winsock-Wrapper) die da unter VB benutzt wird nicht

Da würdest du direkt mit Winsock arbeiten:
http://www.c-plusplus.net/forum/viewtopic-var-t-is-169861-and-start-is-0.html
-
Habe es mal in C probiert da kann aber keine Verbindung zum SMTP-Server hergestellt werden...
-
Ich habe es in C geschafft
xD
Verbindung wird hergestellt,nur leider kommt wieder keine Mail an und der Server gibt auch keine Fehlermeldung zurück...
-
Antwortet er denn auf HELO ?
-
Jo....
Ich weiß irgendwie net woran es liegt!
-
Hmm, poste doch mal ein wenig source, vllt. fällt dann hier irgendwem was auf...