AutoIt
AutoIt
Upload .eml File to an IMAP Mailbox
See more IMAP Examples
Demonstrates how to upload the MIME source of an email to a mailbox on an IMAP server.Chilkat AutoIt Downloads
Local $bSuccess = False
$oImap = ObjCreate("Chilkat.Imap")
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
; Connect to an IMAP server.
; Use TLS
$oImap.Ssl = True
$oImap.Port = 993
$bSuccess = $oImap.Connect("MY-IMAP-DOMAIN")
If ($bSuccess <> True) Then
ConsoleWrite($oImap.LastErrorText & @CRLF)
Exit
EndIf
; Login
$bSuccess = $oImap.Login("MY-IMAP-LOGIN","MY-IMAP-PASSWORD")
If ($bSuccess <> True) Then
ConsoleWrite($oImap.LastErrorText & @CRLF)
Exit
EndIf
$oSbMime = ObjCreate("Chilkat.StringBuilder")
$oSbMime.LoadFile("qa_data/eml/emoji_pizza.eml","utf-8")
; Upload to the mailbox.
$bSuccess = $oImap.AppendMime("[Gmail]/testFolder",$oSbMime.GetAsString())
If ($bSuccess <> True) Then
ConsoleWrite($oImap.LastErrorText & @CRLF)
Exit
EndIf
$oImap.Disconnect()
ConsoleWrite("OK." & @CRLF)