Send files to your mailbox in windows and use vbs to send emails

Source: Internet
Author: User

In Linux, you can use mutt to send emails conveniently. In the previously used VPs space, only scripts can be written and mutt can be used to regularly back up the database and send it to the specified mailbox. You do not need to set the email address of the sender.

In Windows, how does one send attachments to the specified mailbox?

I started to wonder if mutt can be used for windows, but it is troublesome to install it. After searching the information, it is better to use vbs to send it. With the bat batch command, you can back up the database and send it to the specified mailbox.

VbsSource codeAs follows:

 
Namespace = "http://schemas.microsoft.com/cdo/configuration/" set email = Createobject ("CDO. message ") email. from = "account @ QQ.com" email. to = "account to be sent to @ QQ.com" email. subject = "test Sendmail. vbs "email. textbody = "OK! "Email. addattachment "D: \ dfj.zip" with email. configuration. fields. item (namespace & "sendusing") = 2. item (namespace & "smtpserver") = "smtp.qq.com ". item (namespace & "smtpserverport") = 25. item (namespace & "smtpauthenticate") = 1. item (namespace & "sendusername") = "account ". item (namespace & "sendpassword") = "password ". update end with email. send

 

You must enable the SMTP and POP3 services in your mailbox. Otherwise, the email cannot be sent successfully. If you do not enable it, the QQ system will automatically send an email to you (this is very user-friendly)

If you have any questions, please contact me. QQ 1508496092

Set

You can test the settings ~

Escape characters in batch processing:

 

Reference: On the server we maintain, one server needs to display the "Shanghai Stock Exchange/Shenzhen Stock Exchange" index. Code For what reason, the maintenance personnel should change the date in the HTML file to the date of the day before opening every morning. I want to use bat in this way (this server is a Windows system )? BAT can print the content with ECHO and append it to the file name? Problem:
Of course, "<>" is indispensable for HTML code, such as <HTML>, we all know that the two symbols "<" and ">" represent "input redirection" and "output redirection" respectively, so it is not possible to directly echo <HTML>. Escape characters are required! Key Point: escape characters // Output the <HTML> string in Windows: C: \>
Echo ^ <HTML ^>

<HTML> // Output the <HTML> string in Linux: # Echo \ <HTML \>
<HTML> Summary: "^" Is used for escape characters in windows; "\" is used for escape characters in Linux "\"

 

 

 

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.