[AccessD] How to send Automated E-mails from Access after hours

Bill Benson (vbacreations) vbacreations at gmail.com
Wed Jun 9 23:29:44 CDT 2010


I just posted this on another listserv... I found out that there is no issue
sending via smtp and cdo, but I used to be able to spoof the sender and now
I can't  :-(

Even when I wasn't using it for fun, it was useful to put
Noreply at BlahBlah.com when I was sending a reportout and didn't want a reply
coming to me. Now it seems like the authenticated user always shows as the
sender. Bare bones: (previously posted code showed other arguments) It was
called in an excel macro and now the masked sender in that named range
[spoofemail] no longer masks the sender, although the e-mail is sent.



Sub FalsifySender()
Dim Password As String, UserName As String, iMsg, iConf, Flds
On Error Resume Next
UserName = InputBox("E-Mail Address to send from?", "Enter Sender's e-Mail
Address", GetSetting(ThisWorkbook.Name, "UserInfo", "GmailUserName",
"someone at Gmail.com"))

Password = InputBox("E-Mail Password?", "Enter Password",
GetSetting(ThisWorkbook.Name, "UserInfo", "GmailPassword",
"MyGmailAcctPassword"))
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") = UserName
Flds.Item(schema & "sendpassword") = Password
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
 
With iMsg
  .To = [sendto]
  .from = [spoofemail]
  .Sender = [spoofemail]
  .ReplyTo = [spoofemail]
   Set .Configuration = iConf
  .send
End With
End Sub




 




More information about the AccessD mailing list