Outlook 97 MailItem.Send event

J

Julieta Prandi

Hi,
I have 2 questions for you guys that know everything about Outlook:
I've connected the Send event in the MailItem object and I've found that it
has no parameters so I wonder 2 things:
- Can the send process be canceled?
- Is the typelibrary compatible?

Thank you a lot!
(-- Julieta --)
 
D

Dmitry Streblechenko

There is no Send event in Outlook 97. There is a MailItem.Send method of
course.
Processing the OnSubmit/OnWrite/OnWriteComplete/OnSubmitComplete sequence of
events from an ECE is the only way to get a notification when a message is
sent.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
J

Julieta Prandi

Hi Dmitry,
I really glad to receive always your responses.
The MailItem.Send event do exist, I connected and it works in my Outlook 97
but it doesn't have the output parameter to cancel it.
I didn't understand your answer about ECE, what it ECE and I don't know
where I can find the OnSubmit/... events that you've told me.
Please, Dmitry save me again!

(--Julieta--)
 
D

Dmitry Streblechenko

Hmmm... You are right about the Send event. Why doesn't OutlookSpy show that
dispinterface for the mail items in Outlook 97?
ECE is an Exchange Client Extension, that's ewhat people had to do before
COM addins. ECE API still works fine in all versions of Outlook.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
D

Dmitry Streblechenko

Oh, I see what the problem is: ItemEvents is defined both as a regular
interface (?) and as a dispinterface (that's what it need to be). This was
fixed in the Outlook 98 type library.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Joined
Jul 12, 2005
Messages
6
Reaction score
0
Problem sending mail from MSACCESS

Hi All,

I am trying to send an email from MSACCESS (VBA) . But the code is hanging. Please tell me what is wrong! in my code.

Dim strErrMsg As String 'For Error Handling
Dim olApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim oleGrf As Object
Dim strFileName As String

Set olNameSpace = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = "(e-mail address removed)"
.Subject = "Test Mail"
'.Attachments.Add strFileName
.ReadReceiptRequested = False
.Send
End With

Thanks in advance
 
Last edited:
D

Dmitry Streblechenko

1. Please do not hijack existing (unrelated) threads. Create your own.
2. Which line exactly hangs?
3. Did you try to add a call to olNameSpace.Logon immediately after
olApp.GetNamespace?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Joined
Jul 12, 2005
Messages
6
Reaction score
0
Problem sending mail from MSACCESS

Hi Dmitry Streblechenko,

Thanks for reply. I am sorry. I am a new user of this forum. I didn't know how to create a thread. I saw outlook related topic so I posted my question.

My code hangs at ".send" statement. And I have not used .Logon method of "NameSpace". Please help me. I have outlook installed in my PC and always connected to Internet (proxy server).


Dim strErrMsg As String 'For Error Handling
> Dim olApp As New Outlook.Application
> Dim olNameSpace As Outlook.NameSpace
> Dim olMail As Outlook.MailItem
> Dim oleGrf As Object
> Dim strFileName As String
>
> Set olNameSpace = olApp.GetNamespace("MAPI")
> Set olMail = olApp.CreateItem(olMailItem)
> With olMail
> To = "(e-mail address removed)"
> Subject = "Test Mail"
> '.Attachments.Add strFileName
> ReadReceiptRequested = False
> Send
> End With

Thanks and regards
Jyothi
 
Last edited:
Joined
Jul 12, 2005
Messages
6
Reaction score
0
Hi Dmitry Streblechenko,

Following is my code.

Dim olApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMail As Outlook.MailItem

Set olNameSpace = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
. To = "(e-mail address removed)"
. Subject = "Test Mail"
. Send
End With

Thanks and regards
Jyothi
 
D

Dmitry Streblechenko

See the change below (olNameSpace.Logon).
Where is the code running? Are you sure you are not getting the security
prompt in the Send method (which is blocked)?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Joined
Jul 12, 2005
Messages
6
Reaction score
0
Problem sending mail from MSACCESS

Hi Dmitry Streblechenko,

I am running the code in VB module of MSACCESS. And I am not getting any prompt. And I am not able to logon also.



Thank u
 
D

Dmitry Streblechenko

What do you mean by "And I am not able to logon also"? Do you get an error
when calling Namespace.Logon?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Joined
Jul 12, 2005
Messages
6
Reaction score
0
Problem sending mail from MSACCESS

Hi Dmitry,

Now I am not getting any error at ".Logon" statement but it hangs up at ".send" line.
My system is not directly connected to Internet but proxy and also remote SMTP server (my system is in LAN). One more thing is Mcafee Antivirus is running in my system. And I have enabled port 25 which was blocked earlier by this antivirus software. But still it is not running. Please help me.


Thanks
Jyothi
 
D

Dmitry Streblechenko

I don't know, sorry. Does it go out Ok if you call MailItem.Display instead
of MailItem.Send and click on the Send button explicitly?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top