473,804 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CDO Emails not sent till application is exited

I'm new to posting issues online, so bare with me...
Does anyone have any clues on this:
I have an application that is set to run as a service and it sends an
email if an error is encountered. The emailing part seems to work fine
- no errors, except that the emails don't get sent until the
application/service is exited. As soon as I quite the application, the
emails are sent and arrive in my inbox. I need the emails to be sent
without having to shutdown the application. Any clues? Could I be
missing something? Some object that needs to be destroyed?

I'm using the CDO object to generate emails.

Mar 23 '07 #1
7 1451
On Mar 23, 10:59 am, merzi...@gmail. com wrote:
I'm new to posting issues online, so bare with me...
Does anyone have any clues on this:
I have an application that is set to run as a service and it sends an
email if an error is encountered. The emailing part seems to work fine
- no errors, except that the emails don't get sent until the
application/service is exited. As soon as I quite the application, the
emails are sent and arrive in my inbox. I need the emails to be sent
without having to shutdown the application. Any clues? Could I be
missing something? Some object that needs to be destroyed?

I'm using the CDO object to generate emails.
Could you please post some of your sending code?

Mar 23 '07 #2
- The strToList is an array of email addresses.

Public Shared Sub SendMail_CDO(By Val strFrom As String, ByVal
strToList() As String, ByVal subject As String, ByVal body As String)
Const Source As String = "Config.SendMai l_CDO"
Dim iConf As New CDO.Configurati on
Dim Flds As ADODB.Fields

Flds = iConf.Fields
Flds(CDO.CdoCon figuration.cdoS endUsingMethod) .Value =
CDO.CdoSendUsin g.cdoSendUsingP ort
Flds(CDO.CdoCon figuration.cdoS MTPServer).Valu e =
Config.SmtpServ er
Flds(CDO.CdoCon figuration.cdoS MTPServerPort). Value = 25
Flds(CDO.CdoCon figuration.cdoS MTPAuthenticate ).Value =
CDO.CdoProtocol sAuthentication .cdoAnonymous.c doAnonymous
Flds.Update()

Dim strTo As String

Try
For i As Int32 = 0 To strToList.Lengt h - 1
Dim iMsg As New CDO.Message
iMsg.Configurat ion = iConf
strTo = strToList(i).Tr im

iMsg.From = strFrom
iMsg.To = strTo
iMsg.Subject = subject
iMsg.TextBody = body

Trace.WriteTrac e("Sending Email to " + strToList(i))
iMsg.Send()
Trace.WriteTrac e("Sent Email to " + strToList(i))
Next

Catch ex As Exception

End Try
End Sub

Does this help, or do you you need some more context?

Mar 23 '07 #3
On 23 Mar 2007 08:31:15 -0700, me******@gmail. com wrote:
iMsg.
Try adding

iMsg.Dispose();

after you send and see if that helps.
--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 23 '07 #4
Is there any particular reason you're not using CDONTS? Is that old school?
That's what I used in VB6 and it worked like a charm. If you're interested,
post back and I'll post my code.

Robin S.
-----------------------------
<me******@gmail .comwrote in message
news:11******** *************@e 1g2000hsg.googl egroups.com...
>- The strToList is an array of email addresses.

Public Shared Sub SendMail_CDO(By Val strFrom As String, ByVal
strToList() As String, ByVal subject As String, ByVal body As String)
Const Source As String = "Config.SendMai l_CDO"
Dim iConf As New CDO.Configurati on
Dim Flds As ADODB.Fields

Flds = iConf.Fields
Flds(CDO.CdoCon figuration.cdoS endUsingMethod) .Value =
CDO.CdoSendUsin g.cdoSendUsingP ort
Flds(CDO.CdoCon figuration.cdoS MTPServer).Valu e =
Config.SmtpServ er
Flds(CDO.CdoCon figuration.cdoS MTPServerPort). Value = 25
Flds(CDO.CdoCon figuration.cdoS MTPAuthenticate ).Value =
CDO.CdoProtocol sAuthentication .cdoAnonymous.c doAnonymous
Flds.Update()

Dim strTo As String

Try
For i As Int32 = 0 To strToList.Lengt h - 1
Dim iMsg As New CDO.Message
iMsg.Configurat ion = iConf
strTo = strToList(i).Tr im

iMsg.From = strFrom
iMsg.To = strTo
iMsg.Subject = subject
iMsg.TextBody = body

Trace.WriteTrac e("Sending Email to " + strToList(i))
iMsg.Send()
Trace.WriteTrac e("Sent Email to " + strToList(i))
Next

Catch ex As Exception

End Try
End Sub

Does this help, or do you you need some more context?

Mar 23 '07 #5
Better yet, is there any reason you're not using the framework's SMTP mail
classes. There is one mail class in the web section and a newer one in the
general system namespace in .NET 2.0. Both these classes use CDO
underneath.

Mike Ober.

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:OI******** *************** *******@comcast .com...
Is there any particular reason you're not using CDONTS? Is that old
school? That's what I used in VB6 and it worked like a charm. If you're
interested, post back and I'll post my code.

Robin S.
-----------------------------
<me******@gmail .comwrote in message
news:11******** *************@e 1g2000hsg.googl egroups.com...
>>- The strToList is an array of email addresses.

Public Shared Sub SendMail_CDO(By Val strFrom As String, ByVal
strToList() As String, ByVal subject As String, ByVal body As String)
Const Source As String = "Config.SendMai l_CDO"
Dim iConf As New CDO.Configurati on
Dim Flds As ADODB.Fields

Flds = iConf.Fields
Flds(CDO.CdoCon figuration.cdoS endUsingMethod) .Value =
CDO.CdoSendUsi ng.cdoSendUsing Port
Flds(CDO.CdoCon figuration.cdoS MTPServer).Valu e =
Config.SmtpSer ver
Flds(CDO.CdoCon figuration.cdoS MTPServerPort). Value = 25
Flds(CDO.CdoCon figuration.cdoS MTPAuthenticate ).Value =
CDO.CdoProtoco lsAuthenticatio n.cdoAnonymous. cdoAnonymous
Flds.Update()

Dim strTo As String

Try
For i As Int32 = 0 To strToList.Lengt h - 1
Dim iMsg As New CDO.Message
iMsg.Configurat ion = iConf
strTo = strToList(i).Tr im

iMsg.From = strFrom
iMsg.To = strTo
iMsg.Subject = subject
iMsg.TextBody = body

Trace.WriteTrac e("Sending Email to " + strToList(i))
iMsg.Send()
Trace.WriteTrac e("Sent Email to " + strToList(i))
Next

Catch ex As Exception

End Try
End Sub

Does this help, or do you you need some more context?




Mar 23 '07 #6

You need to rewrite your email sending library.

You can get some ideas here.

(1.1 and 2.0 downloadable code)
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)
http://sholliday.spaces.live.com/blog/
<me******@gmail .comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
I'm new to posting issues online, so bare with me...
Does anyone have any clues on this:
I have an application that is set to run as a service and it sends an
email if an error is encountered. The emailing part seems to work fine
- no errors, except that the emails don't get sent until the
application/service is exited. As soon as I quite the application, the
emails are sent and arrive in my inbox. I need the emails to be sent
without having to shutdown the application. Any clues? Could I be
missing something? Some object that needs to be destroyed?

I'm using the CDO object to generate emails.

Mar 23 '07 #7


Frequently Asked Questions for System.Net.Mail

2.0 - http://www.systemnetmail.com/
Frequently Asked Questions for System.Web.Mail

1.1 - http://www.systemwebmail.com/
I'm new to posting issues online, so bare with me...
Does anyone have any clues on this:
I have an application that is set to run as a service and it sends an
email if an error is encountered. The emailing part seems to work fine
- no errors, except that the emails don't get sent until the
application/service is exited. As soon as I quite the application, the
emails are sent and arrive in my inbox. I need the emails to be sent
without having to shutdown the application. Any clues? Could I be
missing something? Some object that needs to be destroyed?
I'm using the CDO object to generate emails.

Mar 24 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1460
by: Joey | last post by:
I am currently developing a C# asp.net application where users are required to register. The application then generates a simple, plain text email and sends it to the new user. I have been trying to use the MailMessage and SmtpMail classes from the System.Web.Mail namespace (built in to .net) to do this. It is my understanding that these classes use CDONTS (cdosys.dll) and the SMTP mail service on the server to send the messages....
5
2978
by: horsetransport | last post by:
Hello, Below is what I "Know how to do" but it doesn't accomplish what I want I have table called sndmail fields that matter useremail and mailsent
0
1220
by: manevski ognjen | last post by:
Hi, I have one problem with console application and threading. In my SMtp class I have method that sends emmails with attachments with html text. Program should work with, let say 10 emails, and everyone of them is different. If i send file of 2Mb html data, the other files in other emails should be sent asynchrony with that file. But my program does not work very well. when I put mmain Thread to sleep, everything works just
1
1879
by: phpuser123 | last post by:
I have visited various sites n when I log in,there is an option "remember me" I want to know how this works....Do they use a cookie for this task..... I usually put time()+3600 for it to expire one hour later ...What should I put as the expiration date such that it remembers me till the next time I log in? The syntax of the coookie is : setcookie(name,value,expire,path,domain,secure)
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.