物聯網平台開發人才平日班

物聯網平台開發人才平日班
【8/30 物聯網平台開發人才養成班】 僅剩最後2位名額,立即下載106年招生簡章!(待業者限定 平日密集培訓)

2016年1月8日 星期五

VBA Email via Gmail CDO Method - Microsoft Access Programmers

Sub SendMailFromGmail() Dim iMsg As Object Dim iConf As Object Dim Flds As Variant Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 Set Flds = iConf.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "test@gmail.com" .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "test132" .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" 'smtp mail server .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'stmp server .Update End With With iMsg Set .Configuration = iConf .To = "test@gmail.com" .From = "test@gmail.com" .Subject = "Hello" & Time .TextBody = "Hi Dude" .Send End With Set iMsg = Nothing Set iConf = Nothing End Sub

沒有留言 :

張貼留言