VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

POP3 to SMTP Forwarder

Read a POP3 mailbox and forwards the email to another email address, keeping the recipients in the original email the same.

Download Chilkat .NET for 2.0 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
Dim mailman As New Chilkat.MailMan()

'  Any string argument automatically begins the 30-day trial.
Dim success As Boolean
success = mailman.UnlockComponent("30-day trial")
If (success <> true) Then
    MsgBox("Component unlock failed")
    Exit Sub
End If


'  Set the POP3 server's hostname
mailman.MailHost = "mail.chilkatsoft.com"

'  Set the POP3 login/password.
mailman.PopUsername = "matt@chilkatsoft.com"
mailman.PopPassword = "****"

Dim saUidls As Chilkat.StringArray

'  The the UIDLs for all email in the POP3 mailbox.
saUidls = mailman.GetUidls()
If (saUidls Is Nothing ) Then
    MsgBox(mailman.LastErrorText)
    Exit Sub
End If


Dim saMime As Chilkat.StringArray

'  Download the email from the server.  Call FetchMultipleMime
'  because we don't want to load the emails into email objects.
'  (We'll delete the emails that are forwarded without error.)
saMime = mailman.FetchMultipleMime(saUidls)

If (saMime Is Nothing ) Then

    MsgBox(mailman.LastErrorText)
    Exit Sub
End If


'  Set the SMTP hostname for sending.
mailman.SmtpHost = "mail.chilkatsoft.com"
mailman.SmtpUsername = "admin@chilkatsoft.com"
mailman.SmtpPassword = "****"

Dim i As Long
Dim strMime As String
Dim n As Long
n = saMime.Count

Dim fromAddr As String
Dim toAddr As String
fromAddr = "matt@chilkatsoft.com"
toAddr = "admin@chilkatsoft.com"

Dim bAllOk As Boolean
bAllOk = true

If (n > 0) Then
    For i = 0 To n - 1

        strMime = saMime.GetString(i)

        '  Forward the email.
        success = mailman.SendMime(fromAddr,toAddr,strMime)
        If (success <> true) Then
            bAllOk = false
            TextBox1.Text = TextBox1.Text & mailman.LastErrorText & vbCrLf
            Exit For
        End If


    Next
End If


'  Remove the emails in saUidls from the POP3 server.
If (bAllOk = true) Then
    success = mailman.DeleteMultiple(saUidls)
    If (success <> true) Then
        TextBox1.Text = TextBox1.Text & mailman.LastErrorText & vbCrLf
    End If

End If




 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser