Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21192

Need help with CDO email to check status of email

$
0
0
I have a MS Access /vba program that sends a xls file to an email address using CDO. The CDO code is standard floating on the web as code pasted below.

It works fine if I have to send a single mail.

I want to loop through several files and some files are about 10MB.

When I loop through, a queue is formed with several emails with 10MB attachment.

And it chokes up. MS Access just hangs.

Is there a way I can check if the first email is loaded?

I would like to work with this kind of code..

While status is "Still loading"
Loop and wait
When status changes to loaded
send next email (using the functionbelow EASMNew(a,b,c))

May I have a request?.. I am not a savvy programmer, do programming for my own business as a hobby. So please bear with my ignorance. I will really appreciate if answers are directed to my level.

Thanks in advance..

JDTX


======
Code..I send mails using this function
======

Public Function EASMNew(em As String, fname1 As String, substr1 As String)

' em is "to" email address, fname is attachment filename, substr1 is subject line string

Dim Attachmt As String
Attachmt = fname1
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Dim Flds As Variant

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "bigspringsubway@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "bss11156"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Update
End With
strbody = ""

With iMsg
Set .Configuration = iConf
.To = em
.CC = ""
.BCC = ""
.FROM = "JDTX" & "xxxxxxxx@gmail.com"
.Subject = substr1
.TextBody = strbody
.AddAttachment Attachmt
.Send
End With

End Function

Viewing all articles
Browse latest Browse all 21192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>