Code for generating and sending emails by calling outlook

Source: Internet
Author: User
Tags microsoft outlook
Code Description: This code can be run on a machine installed with outlook (version 2000 or later. However, for the purpose of preventing mail viruses, outlookxp and later versions monitor the sending of mail. Every email sent using this program requires confirmation by the user, which may be a little troublesome, but it is still out of security considerations. Yes

Code Description: This code can be run on a machine installed with outlook (version 2000 or later. However, for the purpose of preventing mail viruses in outlook xp and later versions, it is a little troublesome to monitor emails sent, but it is still out of security considerations. Yes

CodeNote:
Ben CodeIt can be run on a machine with outlook (version 2000 or later) installed. However, outlook xp and above
To prevent EmailThe purpose of the virus is Send EmailMonitoring, using this program every SendOne letter
Email requests must be confirmed by the user, which may be troublesome, but it is still for security reasons.

You canCodeEmbedded in the access module and excel macro.


Program requirements:

You need to reference "microsoft outlook x. x library"


Code:

Sub email_send ()

Dim olkapp As Outlook. Application
Dim newmail As MailItem
Dim emailadd, para as String

Set olkapp = CreateObject ("outlook. application ")
Set newmail = olkapp. CreateItem (olMailItem)

'EmailBody content
Para = para + "wishing you a happy New Year and reminding you of the newEmailVirus. "

'The recipient's email address. No content is entered here.
Emailadd = ""


With newmail

. To = emailadd
. Subject = "Happy New Year "'EmailTopic
. Importance = olImportanceHigh'EmailIs an important level
. Body = para' willEmailSpecify the content of the para variable in the body.

. Send'Send

End

End sub

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.