send Mail using CDO and MAPI API

capdevs

Member
Joined
Dec 31, 2005
Messages
9
Location
next time
Programming Experience
1-3
hi,

i have some problems, when i send mail using this code.

----------- code----------------------------------

Dim app As Application = New Application
Dim oMail As MailItem

Dim mapi As MAPI.Session = New MAPI.SessionClass
Dim mess As MAPI.Message
Dim strEntry As String
oMail = app.CreateItem(OlItemType.olMailItem)
oMail.To = "shabbir@comsdev.com.pk"
oMail.Body = "Hi a test Message"
oMail.BodyFormat = OlBodyFormat.olFormatHTML

oMail.Close(OlInspectorClose.olSave)
strEntry = oMail.EntryID
oMail = Nothing
mapi.Logon()

Dim msg As MAPI.Messages = mapi.Outbox.Messages()

Dim ms As MAPI.Message
msg.Delete()



mess = mapi.GetMessage(strEntry)
mess.Send()
mapi.Logoff()
mapi = Nothing
app = Nothing

---------end code---------------------


when i try to send mail then this popup display.....

" A PROGRAMM IS TRYING TO SEND
AUTOMETICALLY E-MAIL ON YOUR
BEHALF DO YOU WANT TO ALLOW
THIS. "

my question:
have any way to hide this popup. i want this message should not display


regards
:confused:
 
Maybe you could turn off security in your Outlook program?
 
btw, if we consider your questions posted on the www.dotnetrooms.com forum actually i would say that you are making fuc**** virus or something. All your questions are something like
i want to start outlook but i want that outlook should not show on taskbar only run hiden form....
However i wish to be wrong about you and i wish that your project is ethical as well ...

Regards ;)
 
JohnH said:
Maybe you could turn off security in your Outlook program?
No offence, but that is the most irresponsible advice. Asking your users to turn off security like that.... bad juju.

Besides... as faras I know, there isn't a way to turn that off specificaly.

Kulrom - just because someone wants to turn it off or get rid of that msg doesn't mean it's a virus (although, if a virus maker was able to figure it out...). We've got an app that interacts with Outlook to send out emails based on the status of what ever tasking we are working on. And we get that msg a lot. I wish there was a way to not have it pop up, but at this point there isn't.

I think... I think that it may be possible to get a digital signature for the app that OL will recognize, and then the msgbox no longer appears.... but I don't know for sure how that works.

-tg
 
Wow, we have a smart guy here. JohnH is irresponsible and i am useless right?
Well i suppose you want to confront with me for a long time so, it seems you just found an opportunity :D

Means, in my opinion the idea to sending email messages through Outlook is more than dangerous especially that you want to access the email addresses (stored in outlook) from the external application.
Namely, malicious program authors not only try to use message sending through Outlook to distribute viruses, they also attempt the scanning of address books and message stores in search for more victims and to disguise their messages as messages from the infected user.

That's why with Outlook 2003, the security system already responds not only to an attempt at retrieving the message sender’s address, but even an attempt at viewing its text and Outlook Redemption (that i proposed as solution) is nothing but crack/patch or name it whatever you like.

However, if you gather all puzzles together you will see that there is something unclear.
Why i would run it in unvisible mode and btw hide it from taskbar?
Please explain but have in mind that Microsoft Outlook has been not designed to run hidden.

Best Regards ;)

P.S. JohnH is absolutely right ... to clarify, if you know what it means to leave someone to access email addresses and how big the risk is related to that (and you do not care about that) then why you wouldn't turn off security in your Outlook program?
Btw, why you reply when you do not offer any solution? Just to point out that John and Kulrom are wrong?
Please reread your post and send me the part that offers a kind of solution for the current problem.
 
Last edited:
TechGnome said:
No offence, but that is the most irresponsible advice. Asking your users to turn off security like that.... bad juju.

Besides... as faras I know, there isn't a way to turn that off specificaly.

-tg

If capdevs have to automate Outlook (yes, kulrom, all Office products are built for automation), though should be easier sending with .Nets SMTP, he have to turn off that security setting. The only way to do so is with Microsofts own Administration tool for custom security of Outlook 98/2000.
http://www.slipstick.com/outlook/esecup/olcdo.htm (cdo info regarding 98/200 security update)
http://office.microsoft.com/en-gb/assistance/HA011524811033.aspx (MS info and custom security administration tool)
 
You know.... I just don't know what to say... honestly.... did I piss you off in a former life or something? Where the heck did that come from? All I said was that simply accessing OL from an external app does not make it a virus. Sometimes there are legitimate reasons to do so. That's ALL I was saying.

I'm not trying to be fargin smart ass here, I simply stated that turning OFF security on something like OL is DANGEROUS and as a developer it would be irresponsible for me to tell my users to turn off their OL security. That just isn't going to happen. As a user, I will dump any application that tells me to do this.

Lastly, I don't see anything in the OP or even the other posts that asked on how to hide OL from the taskbar. All the OP wanted to know was how to prevent the security warning messagebox that OL pops up when one of it's objects are accessed by an unsinged, external application. That's all, nothing more, nothing less. It's a prefectly reasonable question. It's a question I've seen several times over. In fact, there should now be nother post asking this question (Again) in about 3-4 months (it's like clock work).

That said, the only way I know is to digitaly sign the app (something most of us aren't going to bother with). There maybe another way, I don't know. But if there is a way, it's not something I think should be openly discussed or shared - you never know who is going to come along and use the code for purposes other than for which it was intended.

For the record:
1) I said the advise was irresponsible... I never said John was irresponsible.
2) I never called you useless (I double checked my post)
3) That's Mr. Smart Arse... not Smart Guy... that would be some one else.
4) I hate confrontations - but I dislike my words being twisted even more.

-tg
 
JohnH said:
If capdevs have to automate Outlook (yes, kulrom, all Office products are built for automation), though should be easier sending with .Nets SMTP, he have to turn off that security setting. The only way to do so is with Microsofts own Administration tool for custom security of Outlook 98/2000.
http://www.slipstick.com/outlook/esecup/olcdo.htm (cdo info regarding 98/200 security update)
http://office.microsoft.com/en-gb/assistance/HA011524811033.aspx (MS info and custom security administration tool)
Of couse the assumption has been made that this is in a networked environment, where there is an Admin that can do such a thing. But the Joe Schmoe at home..... :eek:

-tg
 
From a very related page, there is some info on how(if possible) to remove the security patch altogether, and other stuff like the 'Express ClickYes'. Much related to standalone client.
http://www.slipstick.com/outlook/esecup.htm#remove
In the same page I found this:
The object model guard applies even if your code is digitally signed or running from a published Outlook form.
 
Basicaly it looks like it is bolted on with gorilla glue .... and short of rebuilding the machine, there isn't much hope (especialy after OL2002)... and if I've read it right, and the linked articles.... if you aren't running against an Exchange server with a group policy of some kind, then the chances are less than nil at being able to prevent the display.

Or did I miss something?

-tg
 
TechGnome said:
You know.... I just don't know what to say... honestly.... did I piss you off in a former life or something? Where the heck did that come from? All I said was that simply accessing OL from an external app does not make it a virus. Sometimes there are legitimate reasons to do so. That's ALL I was saying.

I'm not trying to be fargin smart ass here, I simply stated that turning OFF security on something like OL is DANGEROUS and as a developer it would be irresponsible for me to tell my users to turn off their OL security. That just isn't going to happen. As a user, I will dump any application that tells me to do this.

Lastly, I don't see anything in the OP or even the other posts that asked on how to hide OL from the taskbar. All the OP wanted to know was how to prevent the security warning messagebox that OL pops up when one of it's objects are accessed by an unsinged, external application. That's all, nothing more, nothing less. It's a prefectly reasonable question. It's a question I've seen several times over. In fact, there should now be nother post asking this question (Again) in about 3-4 months (it's like clock work).

That said, the only way I know is to digitaly sign the app (something most of us aren't going to bother with). There maybe another way, I don't know. But if there is a way, it's not something I think should be openly discussed or shared - you never know who is going to come along and use the code for purposes other than for which it was intended.

For the record:
1) I said the advise was irresponsible... I never said John was irresponsible.
2) I never called you useless (I double checked my post)
3) That's Mr. Smart Arse... not Smart Guy... that would be some one else.
4) I hate confrontations - but I dislike my words being twisted even more.

-tg

Well, do not try to invoke mercy now. It is more than obvious so, please do not back what you said changing the subject.

Q. Lastly, I don't see anything in the OP or even the other posts that asked on how to hide OL from the taskbar
A. this is the link

Notice that I am still claiming to not use Outlook in this way ..it is too risky and dangerous.

John, you said "yes, kulrom, all Office products are built for automation" but i am wondering why. Did i say opposite or something. I would say: Office automation Yes but missusing NOT. btw, i am using office automation in almost all my projects but not in this way :)

Best Regards ;)
 
Last edited:
Back
Top