Categories
-
-
-
Categories
บทความ อิเล็กทรอนิกส์ คอมพิวเตอร์ Raspberry Pi ปั่นจักรยาน รับออกแบบ PCB
ขั้นตอนแรก ต้องโหลด CDO ก่อน โดยหาโหลดจาก google หรือจะโหลด จาก
http://www.microsoft.com/en-us/download/details.aspx?id=3671
Collaboration Data Objects, version 1.2.1
แล้วก็เขียน Function ตามข้างล่างนี้ โดยแก้ไข Email password
Function Sentemail(BodyEmail As String)
Set iMsg = CreateObject(“CDO.Message”)
Set iConf = CreateObject(“CDO.Configuration”)
Set Flds = iConf.Fields
‘ send one copy with Google SMTP server (with autentication)
schema = “http://schemas.microsoft.com/cdo/configuration/”
Flds.Item(schema & “sendusing”) = 2
Flds.Item(schema & “smtpserver”) = “smtp.gmail.com”
Flds.Item(schema & “smtpserverport”) = 465
Flds.Item(schema & “smtpauthenticate”) = 1
Flds.Item(schema & “sendusername”) = “pndcommand@gmail.com”
Flds.Item(schema & “sendpassword”) = “xxxxxxxx”
Flds.Item(schema & “smtpusessl”) = 1
Flds.Update
With iMsg
.To = “pndcommand@gmail.com”
.From = “pndcommand@gmail.com”
.Subject = “ART Cromo Have New”
.HTMLBody = BodyEmail
Set .Configuration = iConf
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
End Function
ตอนเรียกใช้งาน
Sentemail (“ข้อความของท่านตรงนี้”)