1、创建txt文件,将一下代码复制到里面,后缀名改为.vbs

2、创建计划任务,定时执行(不会的百度或者留言)

3、准备好对应的excel 和背景图,excel有三列,姓名生日邮箱

 

 

Function sendEmail(nameVal, myBirthdayVal, myEmailVal, content1, content2)

 

    OnErrorResumeNext

    NameSpace = “http://schemas.microsoft.com/cdo/configuration/”

    Set Email = CreateObject(“CDO.Message”)

    Email.From = 发件箱

    Email.To = myEmailVal

    Email.Subject = “ףģɺȕ

    Email.AddAttachment “D:\1.jpg”

    Email.htmlBody  = “<body background=\’cid:1.jpg\’>ӊĚȝ”&“<h1>”& nameVal & “</h1>”& myBirthdayVal& content1& content2 & “</body>”

    With Email.Configuration.Fields

        .Item(NameSpace&“sendusing”) = 2

        .Item(NameSpace&“smtpserver”) = 服务器

        .Item(NameSpace&“smtpserverport”) = 25

        .Item(NameSpace&“smtpauthenticate”) = 1

        .Item(NameSpace&“sendusername”) = 用户名

        .Item(NameSpace&“sendpassword”) = 密码

        .Update

    EndWith

    Err.Clear

    Email.Send

    If Err.Number <> 0Then

        SendMail = False

        MsgBox “error”

    Else

        SendMail = True

        \’MsgBox “success”

    EndIf

    Set Email = Nothing

EndFunction

 

 

Function ReadExcel()

    myExcelName = “3.xlsx”

    time1 = Now

    myExcelPath = “D:\3.xlsx”

    Set myExcel = CreateObject(“Excel.Application”)

    myExcel.Workbooks.Open myExcelPath

    myExcel.Visible = False

    myExcel.Windows(myExcelName).Activate

   

   

    \’

版权声明:本文为qq441540598原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/qq441540598/p/6423672.html