VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Sends email without opening up default email sender, or outlook, or CDO.

by Richard Hanning (3 Submissions)
Category: Internet/HTML
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 8th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Sends email without opening up default email sender, or outlook, or CDO.

Rate Sends email without opening up default email sender, or outlook, or CDO.




Private Sub Command1_Click()

    If txtFrom.Text <> "" And txtRcpt.Text <> "" And txtSubject.Text <> "" And txtBody.Text <> "" Then
        wskEmail.Connect "mail.hotmail.com", 25
        Timer1.Enabled = True
    End If

End Sub

Private Sub Command2_Click()

    Timer1.Enabled = False
    wskEmail.Close

End Sub

Private Sub Form_Load()

    Dim MyIP As String

    MyIP = wskEmail.LocalHostName & "'s " & "IP address is " & wskEmail.LocalIP
    Label1.Caption = MyIP
    
End Sub

Private Sub menuExit_Click()

    wskEmail.Close
    End

End Sub

Private Sub Timer1_Timer()
    
    On Error Resume Next
    
    Counter = Counter + 1
    
    If Counter = 1 Then
        wskEmail.SendData "helo" & vbCrLf
    ElseIf Counter = 2 Then
        wskEmail.SendData "mail from: " & txtFrom.Text & vbCrLf
    ElseIf Counter = 3 Then
        wskEmail.SendData "rcpt to: " & txtRcpt.Text & vbCrLf
    ElseIf Counter = 4 Then
        wskEmail.SendData "data" & vbCrLf
    ElseIf Counter = 5 Then
        wskEmail.SendData "subject: " & txtSubject.Text & vbCrLf
    ElseIf Counter = 6 Then
        wskEmail.SendData vbCrLf
    ElseIf Counter = 7 Then
        wskEmail.SendData txtBody.Text & vbCrLf
    ElseIf Counter = 8 Then
        wskEmail.SendData "." & vbCrLf
    ElseIf Counter = 9 Then
        wskEmail.SendData "quit" & vbCrLf
        Timer1.Enabled = False
    End If

End Sub

Private Sub wskEmail_DataArrival(ByVal bytesTotal As Long)

    Dim Incomming As String
    
    wskEmail.GetData Incomming
    Text1.Text = Incomming & vbCrLf & Text1.Text
    
End Sub

Download this snippet    Add to My Saved Code

Sends email without opening up default email sender, or outlook, or CDO. Comments

No comments have been posted about Sends email without opening up default email sender, or outlook, or CDO.. Why not be the first to post a comment about Sends email without opening up default email sender, or outlook, or CDO..

Post your comment

Subject:
Message:
0/1000 characters