所以这就是我到目前为止所做的:
$dll = 'C:\Users\xxxx\Desktop\v4.6\imapx.dll'
[Reflection.Assembly]::LoadFile($dll)
$Username = "xxxxxx"
$Password = "yyyyyy"
# Initialize the IMAP client
$client = New-Object ImapX.ImapClient
###set the fetching mode to retrieve the part of message you want to retrieve,
###the less the better
$client.Behavior.MessageFetchMode = "Full"
$client.Host = "imap.gmail.com"
$client.Port = 993
$client.UseSsl = $true
$client.Connect()
$client.Login($Username, $Password)
# Get folder/label object containing emails you want to read from
$res = $client.folders| where { $_.path -eq 'Inbox' }
# Search email threads inside the subfolder
$numberOfMessagesLimit = 10
$messages = $res.search("All", $client.Behavior.MessageFetchMode, $numberOfMessagesLimit)
# Display the messages in a formatted table
$messages | ft *
foreach($m in $messages){
$m.Subject
foreach($r in $m.Attachments){
$r | Out-File C:\Users\xxxx\Desktop\x\log.txt
}
}
我在log.txt中获得了有关附件文件的信息。
ContentId :
FileData : {120, 120, 120, 120}
FileName : test.txt
Downloaded : True
ContentType : text/plain; name=test.txt; charset=US-ASCII
ContentTransferEncoding : Base64
FileSize : 4
好的,非常好......但现在问题是, 我该如何下载附件?! :D
答案 0 :(得分:2)
<style name="MyEditTextTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">@color/black</item>
<item name="colorControlActivated">@color/action_blue</item>
<item name="colorControlHighlight">@color/action_blue</item>
</style>
<style name="addressbookitem_edit_style" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">13sp</item>
<item name="android:theme">@style/MyEditTextTheme</item>
<android.support.v7.widget.AppCompatEditText
style="@style/addressbookitem_edit_style"/>