BCC command for VBS script

What is the BCC command used for VBS script when compiling an email?
100questionsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul MacDonaldDirector, Information SystemsCommented:
Set objEmail = CreateObject( "CDO.Message" )

   With objEmail
        .From     = myFrom
        .To       = myTo
        .Cc     = myCC
         .Bcc    = myBCC
        .Subject  = mySubject
        .TextBody = myTextBody
        .HTMLBody = myHTMLBody

...etc
0
100questionsAuthor Commented:
Thanks, so how would I modify this code to fit that in?

SubjectDate = InputBox("Date to be added to the subject:", "Enter date")
MailTo = "email1@gmail.com"
From = "mainemail@someprovider.com"
Subject = "This is a test " & SubjectDate
Body = "Hi, This is an VBScript to send email, Regards, User."
Username = "mainemail@someprovider.com"
Password = "passwordhere"
Email MailTo, From, Subject, Body, Username, Password

Sub Email (MailTo, From, Subject, Body, Username, Password)
 Set objMessage = CreateObject("CDO.Message")
 With objMessage
  .Subject = Subject
  .From = From
  .To = MailTo
  .TextBody = Body
 End With
 With objMessage.Configuration.Fields
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mainemail@someprovider.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwordhere"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Update
      End With
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFolder = objFSO.GetFolder("C:\Attachment\")
      Set colFiles = objFolder.Files
      For Each objFile in colFiles
            objMessage.AddAttachment objFile.Path
      Next
      objMessage.Send
End Sub
0
Bill PrewCommented:
Try this:

SubjectDate = InputBox("Date to be added to the subject:", "Enter date")
MailTo = "email1@gmail.com"
From = "mainemail@someprovider.com"
Subject = "This is a test " & SubjectDate
Body = "Hi, This is an VBScript to send email, Regards, User."
Username = "mainemail@someprovider.com"
Password = "passwordhere"
BCC = "email2@gmail.com"

Email MailTo, BCC, From, Subject, Body, Username, Password

Sub Email (MailTo, BCC, From, Subject, Body, Username, Password)
 Set objMessage = CreateObject("CDO.Message")
 With objMessage
  .Subject = Subject
  .From = From
  .To = MailTo
  .BCC = BCC
  .TextBody = Body
 End With
 With objMessage.Configuration.Fields
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mainemail@someprovider.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwordhere"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Update
      End With
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFolder = objFSO.GetFolder("C:\Attachment\")
      Set colFiles = objFolder.Files
      For Each objFile in colFiles
            objMessage.AddAttachment objFile.Path
      Next
      objMessage.Send
End Sub

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
100questionsAuthor Commented:
Thanks so much for that solution Bill, very much appreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 10

From novice to tech pro — start learning today.