Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Can I use VB code to send email in Thunderbird?

  • 1 trả lời
  • 0 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi Matt

more options

I recently changed from Outlook to Thunderbird. A task manager application that I wrote for my own use a few years ago uses the following code to automate sending periodic email reminders. The code looks like the sample below, except that I load the actual values for subject / to / message / body from a table.

o = createobject("outlook.application") oitem=o.createitem(0) oitem.subject = "Email Test" oitem.to = "[email protected]" m.message = "Test message" oitem.body = "Body of test message" oitem.send o=.null.

Is there code snippet I can use to send email via Thunderbird?

Thanks.

- Dean Lesner
I recently changed from Outlook to Thunderbird. A task manager application that I wrote for my own use a few years ago uses the following code to automate sending periodic email reminders. The code looks like the sample below, except that I load the actual values for subject / to / message / body from a table. ************************************* o = createobject("outlook.application") oitem=o.createitem(0) oitem.subject = "Email Test" oitem.to = "[email protected]" m.message = "Test message" oitem.body = "Body of test message" oitem.send o=.null. ************************************* Is there code snippet I can use to send email via Thunderbird? Thanks. - Dean Lesner

Tất cả các câu trả lời (1)

more options

The issue is you no longer have an outlook.application.

Thunderbird does not automate easily, you can use MAPI to compose and prepare the message. You can also use the mailTo: protocol to do the same thing. It is getting the send part that has always stopped me. Thunderbird does not appear to have a send function that can be addressed via an API. It is good from a security point of view as you don't get malware just churning out SPAM using the mail client, unless someone click the send button. Bad for casual users of mail send code. Although direct SMTP delivery is really not that onerous.

It is easier in my opinion to use an SMTP library to send the mail directly to the outgoing server. If you use an outlook or Gmail outgoing server then the associated IMAP account will synchronize the sent mail back to the appropriate Thunderbird sent folder so you have a local record.

See https://learn.microsoft.com/en-us/dotnet/api/system.net.mail.smtpclient?view=net-7.0 which links to a preferred library rather than the internal functions.