Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Sub email()
  2. Const username = "me@school.org"
  3. Const password = "password"
  4.  
  5. Dim objEmail, objConfig
  6. Set objEmail = CreateObject("CDO.Message")
  7.  
  8. objEmail.From = "me@school.org"
  9. objEmail.To = "me@school.org" 'I want the To address to be loaded based on a cell in the selected column'
  10. objEmail.Subject = "missing assignments"
  11. objEmail.cc = "advisor@school.org" 'I want the CC address to be loaded based on a cell in the selected column'
  12.  
  13. Do While Len(objEmail.TextBody) = 0 ‘I’m not sure what this line of code is doing’
  14. objEmail.TextBody = “You are missing the below assignments”
  15. ‘what do I add if I then want the body of the email to be a range of cells, based on the column currently selected?’
  16.  
  17. Loop
  18. Set objConfig = objEmail.Configuration
  19.  
  20. objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtp.gmail.com
  21. 'I don't know what this is for my school, we use gmail, but the address is not @gmail'
  22. objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
  23. objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  24. objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  25. objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
  26. objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/sendusername") = username
  27. objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password
  28.  
  29. objConfig.Fields.Update
  30.  
  31. objEmail.Send
  32.  
  33. Set objEmail = Nothing
  34. Set objConfig = Nothing
  35. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement