Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Outlook, MAPI, Sending Mail

Reply
Thread Tools

Outlook, MAPI, Sending Mail

 
 
Jade Tucker
Guest
Posts: n/a
 
      08-18-2008
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
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jeff Miller
Guest
Posts: n/a
 
      08-19-2008
Jade Tucker wrote:
> Hi All,
>

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

> 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


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Peña, Botp
Guest
Posts: n/a
 
      08-19-2008
RnJvbTogSmFkZSBUdWNrZXIgW21haWx0bzpqdHVja2VyQHhvam V0LmNvbV0gDQojIEkgYW0gdHJ5
aW5nIHRvIHdyaXRlIGEgcHJvZ3JhbSB0byB0ZXN0IHRoYXQgb3 VyIGVtYWlsIHNlcnZlcnMgYXJl
DQojIHdvcmtpbmcgcHJvcGVybHkuIEkgaGF2ZSBhIHJ1YnkgcH JvZ3JhbSB0byBzZW5kIGFuIGVt
YWlsIGZyb20gYSBNUw0KIyBPdXRsb29rIGluYm94IGNvbm5lY3 RlZCB0byBhbiBleGNoYW5nZSBt
YWlsIHNlcnZlci4gIFRoZSBwcm9ncmFtIHVzaW5nIA0KDQpqdX N0IHVzZSBydWJ5J3MgbmV0L3Nt
dHAgYW5kIHlvdXIgZmluZS4gaW4gZmFjdCwgc2luY2UgeW91J3 JlIGNvZGluZyBpdCwgeW91IGNh
biBkbyBhIG1vcmUgZ3JhbnVsYXIgY2hlY2tpbmcgb2YgeW91ci BzZXJ2ZXJzIGJ5DQoNCmEuIGNo
ZWNraW5nIGNvbm5lY3Rpb24gdGhydSBwaW5nDQpiLiBjaGVja2 luZyBzZXJ2aWNlIHRocnUgcG9y
dCAyNQ0KYy4gY2hlY2tpbmcgZW1haWwgZnhuYWxpdHkgYnkgc2 VuZGluZyBhbiBlbWFpbC4gZm9y
IGEgc2FtcGxlLCBzZWUgbXkgbGFzdCBwb3N0IGhlcmUgaHR0cD ovL2dyb3Vwcy5nb29nbGUuY29t
L2dyb3VwL3J1YnktdGFsay1nb29nbGUvYnJvd3NlX3RocmVhZC 90aHJlYWQvOTU3ZGM1YTNiMTcz
ODlhYw0KDQpraW5kIHJlZ2FyZHMgLWJvdHANCg0KDQoNCg0KDQ o=

 
Reply With Quote
 
Glen Holcomb
Guest
Posts: n/a
 
      08-19-2008
On Tue, Aug 19, 2008 at 4:28 AM, Pe=F1a, Botp <> wrot=
e:

> From: Jade Tucker [private.php?do=newpm&u=]
> # 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-...d/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)

 
Reply With Quote
 
Jade Tucker
Guest
Posts: n/a
 
      08-19-2008
Glen Holcomb wrote:
> On Tue, Aug 19, 2008 at 4:28 AM, Peña, Botp <>
> wrote:
>
>> c. checking email fxnality by sending an email. for a sample, see my last
>> post here
>> http://groups.google.com/group/ruby-...7dc5a3b17389ac
>>
>> kind regards -botp
>>
>>
>>
>>
>>
>>

> 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


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Failure Sending Mail" when using System.Net.Mail and ASP.Net 2.0 HoustonComputerGuy@gmail.com ASP .Net 4 09-28-2007 03:57 PM
problem sending mail: Sending the email to the following server failed Luke Java 2 03-15-2007 10:54 AM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM
Sending Mail via System.Net.Mail problem =?Utf-8?B?T3Bh?= ASP .Net 3 01-31-2006 06:44 PM
Sending e-mail with attachments with the default e-mail client =?ISO-8859-1?Q?Andr=E9s_Berenguer?= Java 0 08-29-2003 02:28 PM



Advertisments