Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub email()
- Const username = "me@school.org"
- Const password = "password"
- Dim objEmail, objConfig
- Set objEmail = CreateObject("CDO.Message")
- objEmail.From = "me@school.org"
- objEmail.To = "me@school.org" 'I want the To address to be loaded based on a cell in the selected column'
- objEmail.Subject = "missing assignments"
- objEmail.cc = "advisor@school.org" 'I want the CC address to be loaded based on a cell in the selected column'
- Do While Len(objEmail.TextBody) = 0 ‘I’m not sure what this line of code is doing’
- objEmail.TextBody = “You are missing the below assignments”
- ‘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?’
- Loop
- Set objConfig = objEmail.Configuration
- objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtp.gmail.com
- 'I don't know what this is for my school, we use gmail, but the address is not @gmail'
- objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
- objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
- objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
- objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
- objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/sendusername") = username
- objConfig.Fields ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = password
- objConfig.Fields.Update
- objEmail.Send
- Set objEmail = Nothing
- Set objConfig = Nothing
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement