(AutoIt) Upload .eml File to an IMAP Mailbox
Demonstrates how to upload the MIME source of an email to a mailbox on an IMAP server.
$oImap = ObjCreate("Chilkat.Imap")
; This example assumes Chilkat Imap to have been previously unlocked.
; See Unlock Imap for sample code.
; Connect to an IMAP server.
; Use TLS
$oImap.Ssl = True
$oImap.Port = 993
Local $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)
|