Truy cap email tam thoi qua ung dung email yeu thich cua ban
ZuckMails ho tro ca hai giao thuc IMAP va POP3, cho phep ban doc email tam thoi bang bat ky ung dung email nao nhu Thunderbird, Outlook, Apple Mail, hoac cac thu vien lap trinh.
Dong bo email real-time. Email duoc giu tren server, ho tro nhieu thiet bi truy cap cung luc. Phu hop de theo doi hop thu lien tuc.
Tai email ve may. Don gian, nhe, phu hop cho cac script tu dong hoa hoac ung dung can tai email ve xu ly cuc bo.
Su dung thong tin duoi day de cau hinh ung dung email cua ban:
| Cai dat IMAP Server | |
|---|---|
| Server | imap.zuckmails.com |
| Port | 1143 |
| Ma hoa | Khong (Plain text) |
| Ten dang nhap | Dia chi email day du (vd: [email protected]) |
| Mat khau | Giong ten dang nhap (dia chi email) |
| Phuong thuc xac thuc | PLAIN / LOGIN |
| Cai dat POP3 Server | |
|---|---|
| Server | pop3.zuckmails.com |
| Port | 1100 |
| Ma hoa | Khong (Plain text) |
| Ten dang nhap | Dia chi email day du (vd: [email protected]) |
| Mat khau | Giong ten dang nhap (dia chi email) |
| Phuong thuc xac thuc | PLAIN |
Luu y: Email tam thoi co thoi han su dung. Khi email het han, ban se khong the truy cap qua IMAP/POP3 nua. Hay tao email moi tren trang chu truoc khi ket noi.
Tich hop IMAP/POP3 vao ung dung cua ban voi cac ngon ngu lap trinh pho bien:
# Python - IMAP import imaplib mail = imaplib.IMAP4('imap.zuckmails.com', 1143) mail.login('[email protected]', '[email protected]') mail.select('INBOX') status, messages = mail.search(None, 'ALL') for num in messages[0].split(): status, data = mail.fetch(num, '(RFC822)') print(data[0][1].decode()) mail.logout()
# Python - POP3 import poplib pop = poplib.POP3('pop3.zuckmails.com', 1100) pop.user('[email protected]') pop.pass_('[email protected]') count, size = pop.stat() for i in range(1, count + 1): status, lines, octets = pop.retr(i) msg = b'\n'.join(lines).decode() print(msg) pop.quit()
// Node.js - IMAP (using imapflow) const { ImapFlow } = require('imapflow'); const client = new ImapFlow({ host: 'imap.zuckmails.com', port: 1143, auth: { user: '[email protected]', pass: '[email protected]' }, secure: false }); await client.connect(); const lock = await client.getMailboxLock('INBOX'); for await (const msg of client.fetch('1:*', { source: true })) { console.log(msg.source.toString()); } lock.release(); await client.logout();
// C# - IMAP (using MailKit) using MailKit.Net.Imap; using MailKit; using MimeKit; using var client = new ImapClient(); client.Connect("imap.zuckmails.com", 1143, false); client.Authenticate("[email protected]", "[email protected]"); var inbox = client.Inbox; inbox.Open(FolderAccess.ReadOnly); for (int i = 0; i < inbox.Count; i++) { var message = inbox.GetMessage(i); Console.WriteLine($"From: {message.From}"); Console.WriteLine($"Subject: {message.Subject}"); Console.WriteLine(message.TextBody); } client.Disconnect(true);
// C# - POP3 (using MailKit) using MailKit.Net.Pop3; using var client = new Pop3Client(); client.Connect("pop3.zuckmails.com", 1100, false); client.Authenticate("[email protected]", "[email protected]"); for (int i = 0; i < client.Count; i++) { var message = client.GetMessage(i); Console.WriteLine($"Subject: {message.Subject}"); } client.Disconnect(true);
// Go - IMAP (using go-imap) package main import ( "fmt" "log" "github.com/emersion/go-imap" "github.com/emersion/go-imap/client" ) func main() { c, err := client.Dial("imap.zuckmails.com:1143") if err != nil { log.Fatal(err) } defer c.Logout() err = c.Login("[email protected]", "[email protected]") if err != nil { log.Fatal(err) } mbox, _ := c.Select("INBOX", false) seqset := new(imap.SeqSet) seqset.AddRange(1, mbox.Messages) messages := make(chan *imap.Message, 10) go c.Fetch(seqset, []imap.FetchItem{imap.FetchEnvelope}, messages) for msg := range messages { fmt.Printf("Subject: %s\n", msg.Envelope.Subject) } }
// Rust - IMAP (using imap crate) use imap; fn main() -> Result<(), Box<dyn std::error::Error>> { let client = imap::ClientBuilder::new( "imap.zuckmails.com", 1143 ).connect()?; let mut session = client.login( "[email protected]", "[email protected]" ).map_err(|e| e.0)?; session.select("INBOX")?; let messages = session.fetch("1:*", "(RFC822)")?; for msg in messages.iter() { if let Some(body) = msg.body() { let text = std::str::from_utf8(body)?; println!("{}", text); } } session.logout()?; Ok(()) }
// C++ - POP3 (using libcurl) #include <curl/curl.h> #include <iostream> #include <string> static size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* out) { out->append((char*)contents, size * nmemb); return size * nmemb; } int main() { CURL* curl = curl_easy_init(); std::string response; curl_easy_setopt(curl, CURLOPT_URL, "pop3://pop3.zuckmails.com:1100/1"); curl_easy_setopt(curl, CURLOPT_USERNAME, "[email protected]"); curl_easy_setopt(curl, CURLOPT_PASSWORD, "[email protected]"); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); CURLcode res = curl_easy_perform(curl); if (res == CURLE_OK) std::cout << response << std::endl; curl_easy_cleanup(curl); return 0; }
// PHP - IMAP $inbox = imap_open( '{imap.zuckmails.com:1143/imap/novalidate-cert}INBOX', '[email protected]', '[email protected]' ); $emails = imap_search($inbox, 'ALL'); if ($emails) { foreach ($emails as $num) { $header = imap_headerinfo($inbox, $num); $body = imap_fetchbody($inbox, $num, '1'); echo $header->subject . "\n"; echo $body . "\n"; } } imap_close($inbox);
Dung IMAP neu ban muon theo doi hop thu real-time tren nhieu thiet bi. Dung POP3 neu ban can tai email ve xu ly bang script tu dong.
Email tam thoi la cong khai va tu dong xoa sau khi het han. Mat khau la chinh dia chi email de don gian hoa qua trinh truy cap.
Hien tai server su dung ket noi plain text. Do email la tam thoi va cong khai nen khong can ma hoa. Phien ban tuong lai se ho tro TLS.
Khi email tam thoi het han, ket noi IMAP/POP3 se bi tu choi. Ban can tao email moi tren trang chu va ket noi lai.