Outlook, MAPI, Sending Mail

J

Jade Tucker

Hi All,

I am trying to write a program to test that our email servers are
working properly.

I have a ruby program to send an email from a MS Outlook inbox connected
to an exchange mail server. The program using WIN32OLE to connect to
Outlook. The program sends an email to another email account (out of
our network) that is setup to automatically send back the email. My
program then waits for the email to return for a max of 5 minutes before
it will fail.

The first issue I encountered was Outlook poping up a dialog box warning
me that a program was trying to send an email on my behalf. With
Outlook 2007 I was able to disable this security restriction.

This program needs to run on a server without anyone logged in. For
some reason this is not working as a scheduled task set to run under the
user the email account is setup for.

I am looking for any help or advice on how to get this working. I am
getting frustrated with developing applications that run fine normaly,
but as soon as I try to run them on a schedule or invoked remotely they
start breaking.

Does anyone know of a better way to do this or can help me with my
problem?

Thanks,
JT
 
J

Jeff Miller

Jade said:
Hey there,
I had to develop an application that had to interact with Outlook quite
a bit - however, I recommend that you use MAPI/CDO via the Exchange side
rather than through client-side outlook, since you have less
dependencies and a less likely chance of it breaking. Check out some VB
examples from CDOlive.com and outlookcode.com . There is great help
there.

Good luck,
- Jeff Miller
 
P

Peña, Botp

RnJvbTogSmFkZSBUdWNrZXIgW21haWx0bzpqdHVja2VyQHhvamV0LmNvbV0gDQojIEkgYW0gdHJ5
aW5nIHRvIHdyaXRlIGEgcHJvZ3JhbSB0byB0ZXN0IHRoYXQgb3VyIGVtYWlsIHNlcnZlcnMgYXJl
DQojIHdvcmtpbmcgcHJvcGVybHkuIEkgaGF2ZSBhIHJ1YnkgcHJvZ3JhbSB0byBzZW5kIGFuIGVt
YWlsIGZyb20gYSBNUw0KIyBPdXRsb29rIGluYm94IGNvbm5lY3RlZCB0byBhbiBleGNoYW5nZSBt
YWlsIHNlcnZlci4gIFRoZSBwcm9ncmFtIHVzaW5nIA0KDQpqdXN0IHVzZSBydWJ5J3MgbmV0L3Nt
dHAgYW5kIHlvdXIgZmluZS4gaW4gZmFjdCwgc2luY2UgeW91J3JlIGNvZGluZyBpdCwgeW91IGNh
biBkbyBhIG1vcmUgZ3JhbnVsYXIgY2hlY2tpbmcgb2YgeW91ciBzZXJ2ZXJzIGJ5DQoNCmEuIGNo
ZWNraW5nIGNvbm5lY3Rpb24gdGhydSBwaW5nDQpiLiBjaGVja2luZyBzZXJ2aWNlIHRocnUgcG9y
dCAyNQ0KYy4gY2hlY2tpbmcgZW1haWwgZnhuYWxpdHkgYnkgc2VuZGluZyBhbiBlbWFpbC4gZm9y
IGEgc2FtcGxlLCBzZWUgbXkgbGFzdCBwb3N0IGhlcmUgaHR0cDovL2dyb3Vwcy5nb29nbGUuY29t
L2dyb3VwL3J1YnktdGFsay1nb29nbGUvYnJvd3NlX3RocmVhZC90aHJlYWQvOTU3ZGM1YTNiMTcz
ODlhYw0KDQpraW5kIHJlZ2FyZHMgLWJvdHANCg0KDQoNCg0KDQo=
 
G

Glen Holcomb

From: Jade Tucker [mailto:[email protected]]
# I am trying to write a program to test that our email servers are
# working properly. I have a ruby program to send an email from a MS
# Outlook inbox connected to an exchange mail server. The program using

just use ruby's net/smtp and your fine. in fact, since you're coding it,
you can do a more granular checking of your servers by

a. checking connection thru ping
b. checking service thru port 25
c. checking email fxnality by sending an email. for a sample, see my last
post here
http://groups.google.com/group/ruby-talk-google/browse_thread/thread/957d= c5a3b17389ac

kind regards -botp
Small qualifier here. Outlook doesn't always do SMTP, it can be turned off
by the more Evangelical MS Admins.

--=20
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
 
J

Jade Tucker

Glen said:
Small qualifier here. Outlook doesn't always do SMTP, it can be turned
off
by the more Evangelical MS Admins.

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)

Thanks for the tips. But yeah, I can't test with SMTP and I already
have another app to do ping tests on all of our servers.

UPDATE-- I got the app to work. I had to end up using Outlook 2003 on
the server. I had to use a plugin (forgot the name but i can get it) to
modify the security settings in '03 so that it doesn't keep asking me to
allow the message to be sent. Part of my problem was that the Outlook
app wanted my password everytime it tried to send an email. I just
checked the box to remember the password.

Also, to anyone programming something that sends an email with outlook
03, you have to use the SyncObjects method after using message.Send or
else it will just put it in your outbox and not send the message. It
doesn't seem to do this in '07. Also, 07 provides the ole method
SendAndRecieve.

Here is a little code to clarify:

require 'win32ole'

@outlook = WIN32OLE.new('Outlook.Application')
@mapi = @outlook.GetNameSpace('MAPI')

message = @outlook.createItem(0)
message.subject('some subject')
...
message.Save
message.Send

@mapi.SyncObjects #OR with '07 @mapi.SendAndRecieve
 

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

Similar Threads


Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top