Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
DavidP Absent Member.
Absent Member.
4992 views

email using cdo and vbscript

Jump to solution

Does anyone know why when sending emails CC and BCC does not work? I am using VBSCRIPT with CDO.

Thanks,

David

0 Likes
1 Solution

Accepted Solutions
Knowledge Partner
Knowledge Partner

RE: email using cdo and vbscript

Jump to solution

Semicolon separated is correct.


Tom Morrison
Consultant

View solution in original post

0 Likes
10 Replies
neidingd Honored Contributor.
Honored Contributor.

RE: email using cdo and vbscript

Jump to solution

Sounds not like an cobol problem!

More infos would be nice... CC and BCC with CDO should work, but without infos about the vbscript help isn't possible.

0 Likes
Knowledge Partner
Knowledge Partner

RE: email using cdo and vbscript

Jump to solution

Are you using the VBScript previously posted in this forum?  If so, can you post a copy of your parameter file?


Tom Morrison
Consultant

0 Likes
DavidP Absent Member.
Absent Member.

RE: email using cdo and vbscript

Jump to solution

Below is a portion of the VB script that was generated.

This used to work then all of a sudden it quit working.

Set objMessage = CreateObject("CDO.Message")

objMessage.Subject = EmailSubject

objMessage.From = EmailFrom

objMessage.To = EmailTo

objMessage.Cc = "sdperry1@comcast.net"

objMessage.TextBody = EmailBody

objMessage.AddAttachment EmailAtt1

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../sendusing&quot😉 = 2

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpserver&quot😉 = SMTPServer

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpauthenticate&quot😉 = cdoBasic

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../sendusername&quot😉 = SMTPLogon

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../sendpassword&quot😉 = SMTPPassword

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpserverport&quot😉 = SMTPPort

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpusessl&quot😉 = SMTPSSL

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpconnectiontimeout&quot😉 = 60

objMessage.Configuration.Fields.Update

objMessage.Send

Thanks,

David

0 Likes
neidingd Honored Contributor.
Honored Contributor.

RE: email using cdo and vbscript

Jump to solution

Tested only with a little part if CC works... and works without problems

Set objMessage = CreateObject("CDO.Message")

objMessage.Subject = "Testmail"

objMessage.From = "noreply@muffenrohr.de"

objMessage.To = "edv@muffenrohr.de"

objMessage.Cc = "d.neidinger@muffenrohr.de"

objMessage.TextBody = "I am a test"

'==This section provides the configuration information for the remote SMTP server.

'==Normally you will only change the server name or IP.

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../sendusing&quot😉 = 2

'Name or IP of Remote SMTP Server

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpserver&quot😉 = "smtp.mail.saint-gobain.net"

'Server port (typically 25)

objMessage.Configuration.Fields.Item _

("schemas.microsoft.com/.../smtpserverport&quot😉 = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

0 Likes
Knowledge Partner
Knowledge Partner

RE: email using cdo and vbscript

Jump to solution

There is an example of a fully working VBScript + CDO at:

community.microfocus.com/.../11213.aspx

If you are continuing to have problems, please zip the script and the calling COBOL program and attach the file to your reply.  (Use the "Use rich formatting" link, then click on the Options tab to find the ability to add a file.)


Tom Morrison
Consultant

0 Likes
DavidP Absent Member.
Absent Member.

RE: email using cdo and vbscript

Jump to solution

Thanks!

I think I figured out what is going on. It seems to be only sending to the last CC line.

.

Can you have more than 1 CC line such as

objMessage.Cc = "anna.canterberry@glazers.com"

objMessage.Cc = "sdperry1@comcast.net"

or

Do they need to be strung together like

"anna.canterberry@glazers.com; sdperry1@comcast.net"?

Also can you send the email to yourself and also to yourself as a CC

such as

objMessage.Cc = "anna.canterberry@glazers.com"

objMessage.Cc = "sdperry1@comcast.net"

objMessage.Cc = "sdperry1@comcast.net"?

Thanks,

David

0 Likes
Knowledge Partner
Knowledge Partner

RE: email using cdo and vbscript

Jump to solution

Semicolon separated is correct.


Tom Morrison
Consultant

View solution in original post

0 Likes
DavidP Absent Member.
Absent Member.

RE: email using cdo and vbscript

Jump to solution

Thanks! Can you send to the same email twice in a CC line?

Example: objMessage.Cc = "sdperry1@comcast.net; sdperry1@comcast.net"

Should it send 2 emails in this example?

David

0 Likes
Knowledge Partner
Knowledge Partner

RE: email using cdo and vbscript

Jump to solution

That would probably depend on the mail agent.  My guess is that CDO merely connects to the mail transfer agent and sends the information you have provided.  The mail transfer agent then can decide to eliminate duplicate addresses, etc, in order to minimize transmit time.


Tom Morrison
Consultant

0 Likes
DavidP Absent Member.
Absent Member.

RE: email using cdo and vbscript

Jump to solution

Thanks Tom. That worked.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.