Tengo varios meses luchando contra lo mismo, y no encuentro la solucion deseada. Posteo:
quiero saber si es posible enviar correos anonimos con algun codigo vb, y que no requiera de librerias extras como ocx, dll, etc.
Estoy creando un cliente de correo, para que envie a cuentas POP3 que ocurre, Yo No quiero que mi cliente use librerias ocx, ni Dll, y en caso de que las Use porfavor como se le hace para fusionar los controles con el mismo exe, aunque el resultado final sea un programa Muy Grande. Tampoco quiero que mi mail envie correos por Outlook, quiero hacer un prog, que use algun puerto para conectarse pero sin user ocx ni dll, porfavor tengo tiempo buscando solucion. Aqui les pongo mi codigo, para que en base a el me expliquen como hacer lo ke busco,por obligacion me he visto a utilizar el control ocx, porke NO se como se hace sin el, pero si existe la manera de obmitirlo porfavor diganme, si tengo algo mal en el codigo me corrigen. Gracias
Private Enum SMTP_State
MAIL_CONNECT
MAIL_HELO
MAIL_FROM
MAIL_RCPTTO
MAIL_DATA
MAIL_DOT
MAIL_QUIT
End Enum
Private m_State As SMTP_State
Private m_strEncodedFiles As String
en el proceso:
txtNoMail = "1"
txtRecipient = "xxxxxxxxxx@xxxxx.xx"
txtSender = "xxxxxxxxxxxxxxxxx@xxxxx.xx"
txtReplyTo = "xxxxxxxxxxx@xxxxx.xx"
txtReplyToName = "Name"
txtRecipientName = "Name2"
txtSenderName = "Golmar"
txtSubject = "Subject"
txtMessage = "Text Message"
FileName = "Archivo.TXT"
sckMail.Connect "SERVIDOR-CORREO", 25
m_State = MAIL_CONNECT
EN EL CONTROL WINSOCK:
Private Sub sckMail_Close()
sckMail.Close
Debug.Print "close"
End Sub
Private Sub sckMail_DataArrival(ByVal bytesTotal As Long)
Dim strServerResponse As String
Dim strResponseCode As String
Dim strDataToSend As String
'
'Retrive data from winsock buffer
'
sckMail.GetData strServerResponse
'
Debug.Print strServerResponse
'
'Get Server response code (first three symbols)
'
strResponseCode = Left(strServerResponse, 3)
'
'Only these three codes tell us that previous
'command accepted successfully and we can go on
'
If strResponseCode = "250" Or _
strResponseCode = "220" Or _
strResponseCode = "354" Then
Select Case m_State
Case MAIL_CONNECT
'Change current state of the session
m_State = MAIL_HELO
'
'Remove blank spaces
strDataToSend = Trim$(txtSender)
'
'Retrieve mailbox name from e-mail address
strDataToSend = Left$(strDataToSend, _
InStr(1, strDataToSend, "@") - 1)
'Send HELO command to the Server
sckMail.SendData "HELO " & strDataToSend & vbCrLf
'
Debug.Print "HELO " & strDataToSend
'
Case MAIL_HELO
'
'Change current state of the session
m_State = MAIL_FROM
'
'Send MAIL FROM command to the Server
sckMail.SendData "MAIL FROM:" & Trim$(txtSender) &
vbCrLf
'
Debug.Print "MAIL FROM:" & Trim$(txtSender)
'
Case MAIL_FROM
'
'Change current state of the session
m_State = MAIL_RCPTTO
'
'Send RCPT TO command to the Server
sckMail.SendData "RCPT TO:" & Trim$(txtRecipient) &
vbCrLf
'
Debug.Print "RCPT TO:" & Trim$(txtRecipient)
'
Case MAIL_RCPTTO
'
'Change current state of the session
m_State = MAIL_DATA
'
'Send DATA command to the Server
sckMail.SendData "DATA" & vbCrLf
'
Debug.Print "DATA"
'
Case MAIL_DATA
'
'Change current state of the session
m_State = MAIL_DOT
'
'So now we are sending a message body
'Each line of text must be completed with
'linefeed symbol (Chr$(10) or vbLf) not with vbCrLf -
This is wrong, it should be vbCrLf
'see
http://207.68.164.250/cgi-bin/linkrd?_l ... plf%2ehtml for
details
'
'Send Subject line
sckMail.SendData "From:" & txtSenderName & " <" &
txtSender & ">" & vbCrLf
sckMail.SendData "To:" & txtRecipientName & " <" &
txtRecipient & ">" & vbCrLf
'
Debug.Print "Subject: " & txtSubject
'
If Len(txtReplyTo) > 0 Then
sckMail.SendData "Subject:" & txtSubject & vbCrLf
sckMail.SendData "Reply-To:" & txtReplyToName & " <"
& txtReplyTo & ">" & vbCrLf & vbCrLf
Else
sckMail.SendData "Subject:" & txtSubject & vbCrLf &
vbCrLf
End If
'Dim varLines() As String
'Dim varLine As String
Dim strMessage As String
'Dim i
'
'Add atacchments
strMessage = txtMessage & vbCrLf & vbCrLf &
m_strEncodedFiles
'clear memory
m_strEncodedFiles = ""
'Debug.Print Len(strMessage)
'These lines aren't needed, see
'
'
http://207.68.164.250/cgi-bin/linkrd?_lang=ES&lah=8dac8e580531e333fab2826ac071c818&lat=1056745235&hm___action=http%3a%2f%2fcr%2eyp%2eto%2fdocs%2fsmtplf%2ehtml for details
'
'*****************************************
'Parse message to get lines (for VB6 only)
'varLines() = Split(strMessage, vbNewLine)
'Parse message to get lines (for VB5 and lower)
'SplitMessage strMessage, varLines()
'clear memory
'strMessage = ""
'
'Send each line of the message
'For i = LBound(varLines()) To UBound(varLines())
' SCKMAIL.SendData varLines(i) & vbCrLf
' '
' Debug.Print varLines(i)
'Next
'
'******************************************
sckMail.SendData strMessage & vbCrLf
strMessage = ""
'
'Send a dot symbol to inform Server
'that sending of message comleted
sckMail.SendData "." & vbCrLf
'
Debug.Print "."
'
Case MAIL_DOT
'Change current state of the session
m_State = MAIL_QUIT
'
'Send QUIT command to the Server
sckMail.SendData "QUIT" & vbCrLf
'
Debug.Print "QUIT"
Case MAIL_QUIT
'
'Close connection
sckMail.Close
'
End Select
Else
'
'If we are here Server replied with
'unacceptable respose code therefore we need
'close connection and inform user about problem
'
sckMail.Close
'
If Not m_State = MAIL_QUIT Then
MsgBox "SMTP Error: " & strServerResponse, _
vbInformation, "SMTP Error"
Else
T_Tarea.Caption = "Traspaso Completado"
'MsgBox "Message sent successfuly.", vbInformation
End If
'
End If
End Sub
Private Sub sckMail_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)
Debug.Print Description
End Sub