Nasıl C# kullanarak, Postamdan bir e-posta eki indirebilirim (örneğin gmail)?C# ekleriyle ilgili e-posta eklerini kaydetme C#
8
A
cevap
-3
Aşağıdaki kod, Rebex Mail bileşenle gelen Extract Attachments sample numaralı telefondan alınmıştır. Bir POP3 sunucusundan indirme, HOWTO: Download emails from a GMail account in C# blog yayınında yer almaktadır.
// Load mail message from disk
MailMessage mail = new MailMessage();
mail.Load (args[0]);
Console.WriteLine (
"Message contains {0} attachments.",
mail.Attachments.Count
);
// If message has no attachments, just exit
if (mail.Attachments.Count == 0)
return 0;
foreach (Attachment attachment in mail.Attachments)
{
// Save the file
Console.WriteLine ("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save (attachment.FileName);
}
0
// Firstly you might want to use POP3Class which is mail support class.
POP3Class Pop3= new POP3Class();
pop3.DoConnect("your.mail.server",110,"username","password");
pop3.GetStat();
// and then you can use the below code for storing an attachment.
MailMessage mail = new MailMessage();
Mail.Load (args[0]);
Console.WriteLine (
"Message contains {0} attachments.",
mail.Attachments.Count
);
// If message has no attachments, just exit
if (mail.Attachments.Count == 0)
return 0;
foreach (Attachment attachment in mail.Attachments)
{
// Save the file
Console.WriteLine ("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save (attachment.FileName);
}
// Hope that helps.
+0
'Eklenti' sınıfında bu tür yöntemlere ve özelliklere sahip değilim. , bazı üçüncü taraflar libs kullandın mı? –
+1
POP3Class kitaplığını nereden alabilirim? –
İlgili konular
- 1. Otomatik kaydetme - WPF C#
- 2. görüntü dosyalarını kaydetme C#
- 3. C günlüğe kaydetme kitaplıkları
- 4. Exisit dosyasına c metin kaydetme C#
- 5. C# programının yürütme yolunu kaydetme?
- 6. C# uygulama ayarlarında bayt [] kaydetme
- 7. C# Task.ContinueWith ile ilgili sorunlar
- 8. C# bölümü ile ilgili sorunlar #
- 9. C++ - Parçanayla ilgili veri iletimi
- 10. C# bir HTTP istemcisinden dosya kaydetme
- 11. Caffe C++ ağ caffemodel dosyasını kaydetme
- 12. Eposta çiftleşmiş
- 13. eposta hyperlinkbutton
- 14. Eposta biçimlendirme tableView
- 15. Action delegate C ile ilgili önemli bilgiler C#
- 16. C/C++ kodunun temizlenmesi, variadic makrolarla ilgili sorunları ortaya çıkarır
- 17. Windows ve Mono'da C# Hizmet Ayarlarını Kaydetme
- 18. C# Application Data bir dosya kaydetme
- 19. objektif-c en iyi uygulamaları günlüğe kaydetme
- 20. C - Girilen değişkenleri farklı işlevlere kaydetme
- 21. sqrtf undefined 'sqrtf' ile ilgili c
- 22. PHP eposta doğrulama
- 23. Eposta soğukkanlılık iOS 8
- 24. Eposta açık bildirimi - raylar
- 25. Öğe profilinde Paperclip eklerini Ayarlama
- 26. C# tasarımcısı C: C#
- 27. C++
- 28. C#
- 29. C#
- 30. C++
Ve bize senin için komple bir çözüm yazmak ister misin? –
Bu bağlantı aynı sorunu çözmemde bana yardımcı oldu, ancak bu 30 günlük deneme süresine sahip. http://www.example-code.com/csharp/pop3_saveAttachments.asp Mutlu kodlama – Ravia
Lütfen ans için http://pop3saveattachment.blogspot.in/ – Raj