473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Automating Emails using CDO

Hi,

I am using Access in Office 2003 to try to automate messaging people in my organisation after a certain period has passed. I have managed to do this fine with what little knowledge I have, apart from the fact using Outlook creates a security confirmation message, which ruins the whole automation process. I cannot really bypass this.

I read that using a CDO message would not create this security alert. However, I am not sure exactly how to connect to my server, or whether it would allow me to do this, I have tried to talk to IS, and they haven't got back to me.

I've got various code examples from the internet and when I run them it asks about connection to the server, as below;
Expand|Select|Wrap|Line Numbers
  1. Public Function CDOMail_Click()
  2.  
  3. Set cdoConfig = CreateObject("CDO.Configuration")
  4.  
  5.     With cdoConfig.Fields
  6.         .Item(cdoSendUsingMethod) = cdoSendUsingPort
  7.         .Item(cdoSMTPServer) = "<server name>" 'My server name from Outlook is D1EXC004
  8.         .Update
  9.     End With
  10.  
  11.     Set cdoMessage = CreateObject("CDO.Message")
  12.  
  13.     With cdoMessage
  14.         Set .Configuration = cdoConfig
  15.         .From = "peter.martin@rpa.gsi.gov.uk"
  16.         .To = "peter.martin@rpa.gsi.gov.uk"
  17.         .Subject = "Sample CDO Message"
  18.         .TextBody = "This is a test for CDO.message"
  19.         .Send
  20.     End With
  21.  
  22.     Set cdoMessage = Nothing
  23.     Set cdoConfig = Nothing
  24.  
  25. End Function
  26.  
Any advice as to how to connect to the server for CDO messages would be appreciated
May 22 '07 #1
8 6657
MMcCarthy
14,534 Expert Mod 8TB
I am using Access in Office 2003 to try to automate messaging people in my organisation after a certain period has passed. I have managed to do this fine with what little knowledge I have, apart from the fact using Outlook creates a security confirmation message, which ruins the whole automation process. I cannot really bypass this.
This is an outlook setting and can be turned off in outlook. This would probably not be allowed by your company for security reasons though.

I read that using a CDO message would not create this security alert. However, I am not sure exactly how to connect to my server, or whether it would allow me to do this, I have tried to talk to IS, and they haven't got back to me.

I've got various code examples from the internet and when I run them it asks about connection to the server, as below;
Expand|Select|Wrap|Line Numbers
  1. Public Function CDOMail_Click()
  2.  
  3. Set cdoConfig = CreateObject("CDO.Configuration")
  4.  
  5.     With cdoConfig.Fields
  6.         .Item(cdoSendUsingMethod) = cdoSendUsingPort
  7.         .Item(cdoSMTPServer) = "<server name>" 'My server name from Outlook is D1EXC004
  8.         .Update
  9.     End With
  10.  
  11.     Set cdoMessage = CreateObject("CDO.Message")
  12.  
  13.     With cdoMessage
  14.         Set .Configuration = cdoConfig
  15.         .From = "peter.martin@rpa.gsi.gov.uk"
  16.         .To = "peter.martin@rpa.gsi.gov.uk"
  17.         .Subject = "Sample CDO Message"
  18.         .TextBody = "This is a test for CDO.message"
  19.         .Send
  20.     End With
  21.  
  22.     Set cdoMessage = Nothing
  23.     Set cdoConfig = Nothing
  24.  
  25. End Function
  26.  
Any advice as to how to connect to the server for CDO messages would be appreciated
I don't use CDO so I will leave this for someone else to answer.
May 25 '07 #2
JConsulting
603 Expert 512MB
Hi,

I am using Access in Office 2003 to try to automate messaging people in my organisation after a certain period has passed. I have managed to do this fine with what little knowledge I have, apart from the fact using Outlook creates a security confirmation message, which ruins the whole automation process. I cannot really bypass this.

I read that using a CDO message would not create this security alert. However, I am not sure exactly how to connect to my server, or whether it would allow me to do this, I have tried to talk to IS, and they haven't got back to me.

I've got various code examples from the internet and when I run them it asks about connection to the server, as below;

Public Function CDOMail_Click()

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "<server name>" 'My server name from Outlook is D1EXC004
.Update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "peter.martin@rpa.gsi.gov.uk"
.To = "peter.martin@rpa.gsi.gov.uk"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing

End Function

Any advice as to how to connect to the server for CDO messages would be appreciated

here is the code I use to send mail using CDO

Expand|Select|Wrap|Line Numbers
  1. Public Function SendEmailCDO(ByVal strTo As String, _
  2.                           ByVal strMessage As String, _
  3.                           ByVal strSubject As String, _
  4.                           Optional ByVal strAttach As String)
  5.     Dim objEmail As Object
  6.     On Error Resume Next
  7.     Set objEmail = CreateObject("CDO.Message")
  8.     '**** email address of sender
  9.     objEmail.FROM = "fred@smith.com"
  10.     objEmail.To = strTo
  11.     objEmail.Subject = strSubject
  12.     objEmail.TextBody = strMessage
  13.     If strAttach <> "" Then objEmail.AddAttachment strAttach
  14.     objEmail.Configuration.Fields.Item( "http://schemas.microsoft.com/cdo/configuration/sendusing")=2
  15.     '*** smtp.xxx.com - here u enter your smtp server name, whatever that is
  16.    objEmail.Configuration.Fields.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.xx.com"
  17.     objEmail.Configuration.Fields.Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
  18.     objEmail.Configuration.Fields.Update
  19.     objEmail.Send
  20.     If err.Number <> 0 Then
  21.         MsgBox "Error in sending. " & err.Description
  22.     Else
  23.         MsgBox "Sent"   'remove this if u dont want confirmation
  24.     End If
  25.     Set objEmail = Nothing
  26.  
  27. End Function
  28.  
let me know if you need any followup.
J
May 26 '07 #3
J can CDO be used to open a .oft?
May 29 '07 #4
JConsulting
603 Expert 512MB
J can CDO be used to open a .oft?
.oft?

not sure what that is.
May 29 '07 #5
.oft?

not sure what that is.
.oft is an Outlook file template. Not sure if you can combine a CDO message and open a template file at the same time? I'm looking at doing this but not sure if I'm going about it the right way.

Edit: typos and sentence restructure
May 29 '07 #6
.oft is an Outlook file template. Not sure if you can combine a CDO message and open a template file at the same time? I'm looking at doing this but not sure if I'm going about it the right way.

Edit: typos and sentence restructure
Gawd! I apologise sincerely for this "stupid" and "ignorant" question!! Have since done some other reading and now realise that this is wayyyyyy off the planet.

Jodi
Jun 12 '07 #7
[quote=mmccarthy]This is an outlook setting and can be turned off in outlook. This would probably not be allowed by your company for security reasons though.

I am attempting this same process, and have the access rights to turn this setting off if I knew where to find it :). Can you tell me how to turn the prompt off in Outlook? Thanks!!!
Jun 14 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
This is an outlook setting and can be turned off in outlook. This would probably not be allowed by your company for security reasons though.
I am attempting this same process, and have the access rights to turn this setting off if I knew where to find it :). Can you tell me how to turn the prompt off in Outlook? Thanks!!!
In Outlook 2000 or earlier go to options and under the security tab click on Attachment Security. Be careful though as this disables all attachment security.

In Outlook 2003 or later you will need to use automation VBA code as follows

Expand|Select|Wrap|Line Numbers
  1.  
  2. OlSecurityManager.ConnectTo OutlookApp
  3. OlSecurityManager.DisableOOMWarnings = True
  4. On Error Goto Finally 
  5.  
  6. '... send your mails here ... 
  7.  
  8. Finally: OlSecurityManager.DisableOOMWarnings = False 
  9.  
Jun 14 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Job Lot | last post by:
I how can create vb.net app that checks for emails sent to an address and extract the .xls file attached to the email to a specified location. Also, how can download and upload from a FTP address...
3
by: yoda | last post by:
Hi Guys, I've been used to deploying code to the production server by checking out of subversion and manually sorting out any kinks. (yes, I know, it sounds primitive) I realize I'm losing so...
7
by: xzzy | last post by:
I need to automate a report in a different database (and thank yous to Terry Kreft for pointing me in the right direction). below is the code with the one line that does not work, marked: 'Does...
3
by: Lauren Wilson | last post by:
Hi folks, We have an Access 2000 app that is highly integrated with Outlook 2000 or later. The app allows the user to send predefined emails that are created through an Access form and stored...
0
by: DN | last post by:
I'm receiving automated emails from a web page with a form to e-mail cgi. How can I automate Access to automatically import the contents of the information into my database? Each e-mail has only...
0
by: rcoutts | last post by:
I have a custom Access database that is a bulk mailing program for my small business to send emails to my customers (not spam!). Before sending mail, I export a folder in Outlook to an Access MDB...
8
by: Jimbo | last post by:
Hello I am currently designing an internal ordering system for IT equipment. I am designing it in ASP.NET (vb) using Visual Studio 2003 and using Microsoft SQL Server I have got the system...
7
by: odysseyphotography | last post by:
A friend would like to have a signup form on his site. Anyone that signs up will be entered into a database and automatically sent an email report. This much I can do! However, he'd then like...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.