[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

fiefie.niles

11/17/2010 7:01:00 PM

Our VB program sends an email using MAPI.
If the program runs from a machine with Outlook 2000, the email was
sent without any prompt.
But, if the program runs from a machine with Outlook version later
than 2000 (like my machine has Outlook 2007), before the email is
sent, it prompt a message that say "A program is trying to send an e-
mail message on your behalf. If this is unexpected, click Deny and
verify your antivirus software is up-to-date. For more information
about e-mail safety and how you might be able to avoid getting this
warning, click Help." with buttons "Allo", "Deny" "Help".

I tested by going to my Outlook - Tools - Trust Center - Programmatic
Access and check "Never warn me about suspicious activity (not
recommended) ", but still get the prompt.
Is there anything I can do from my program that will not make the
prompt to show up ?

Thank you
11 Answers

(nobody)

11/17/2010 7:34:00 PM

0

"fniles" <fiefie.niles@gmail.com> wrote in message
news:c4807ce2-bb92-46e4-b75a-dac4821e3ae2@w18g2000vbe.googlegroups.com...
> Our VB program sends an email using MAPI.
> If the program runs from a machine with Outlook 2000, the email was
> sent without any prompt.
> But, if the program runs from a machine with Outlook version later
> than 2000 (like my machine has Outlook 2007), before the email is
> sent, it prompt a message that say "A program is trying to send an e-
> mail message on your behalf. If this is unexpected, click Deny and
> verify your antivirus software is up-to-date. For more information
> about e-mail safety and how you might be able to avoid getting this
> warning, click Help." with buttons "Allo", "Deny" "Help".
>
> I tested by going to my Outlook - Tools - Trust Center - Programmatic
> Access and check "Never warn me about suspicious activity (not
> recommended) ", but still get the prompt.
> Is there anything I can do from my program that will not make the
> prompt to show up ?

Few options:

1 - Use Outlook Redemption(Preferred):

http://www.dimastr.com/r...

2 - Use ClickYes software:

http://www.contextmagic.com/express...



Tony Toews

11/17/2010 7:49:00 PM

0

On Wed, 17 Nov 2010 11:01:17 -0800 (PST), fniles
<fiefie.niles@gmail.com> wrote:

>Our VB program sends an email using MAPI.
>If the program runs from a machine with Outlook 2000, the email was
>sent without any prompt.
>But, if the program runs from a machine with Outlook version later
>than 2000 (like my machine has Outlook 2007), before the email is
>sent, it prompt a message that say "A program is trying to send an e-
>mail message on your behalf. If this is unexpected, click Deny and
>verify your antivirus software is up-to-date. For more information
>about e-mail safety and how you might be able to avoid getting this
>warning, click Help." with buttons "Allo", "Deny" "Help".

I'd suggest asking in an Outlook newsgroup/forum. I have a vague
memory of a comment from someone stating that, in newer versions of
Outlook, if your antivirus and other software is up to date, that you
wouldn't be getting this message. However, as far as I know, Outlook
2007 is one of those newer versions.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/ac...
Tony's Microsoft Access Blog - http://msmvps.com/blo...
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeup...

mbyerley

11/17/2010 9:03:00 PM

0


"fniles" <fiefie.niles@gmail.com> wrote in message
news:c4807ce2-bb92-46e4-b75a-dac4821e3ae2@w18g2000vbe.googlegroups.com...
> Our VB program sends an email using MAPI.
> If the program runs from a machine with Outlook 2000, the email was
> sent without any prompt.
> But, if the program runs from a machine with Outlook version later
> than 2000 (like my machine has Outlook 2007), before the email is
> sent, it prompt a message that say "A program is trying to send an e-
> mail message on your behalf. If this is unexpected, click Deny and
> verify your antivirus software is up-to-date. For more information
> about e-mail safety and how you might be able to avoid getting this
> warning, click Help." with buttons "Allo", "Deny" "Help".
>
> I tested by going to my Outlook - Tools - Trust Center - Programmatic
> Access and check "Never warn me about suspicious activity (not
> recommended) ", but still get the prompt.
> Is there anything I can do from my program that will not make the
> prompt to show up ?
>
> Thank you

In addition to the others, when this came up over a year ago in this group,
I posted Delphi solution to this that you can port to VB. It's not terribly
long and the cached version of the thread is here:

<:http://webcache.googleusercontent.com/search?q=cache:UzklQ3GnRQEJ:www.relatedterms.com/thread/1708288/API%2520question+%22function+Ki...(Clss+:+PChar%3B+Capt+:+PChar)+:+Boolean%3B+Stdcall%22&cd=2&hl=en&ct=clnk&gl=us>


Mayayana

11/17/2010 9:09:00 PM

0

You''re posting to both the VB and the VB.Net group.
??

And didn't you ask about this awhile back? I though
you started out with Outlook, then there were several
discussions about less limited ways to send email.
(Ex.: 9/23 "How do you send an SMTP email with embedded
image ?")

Now you're back to using Outlook automation?

| Our VB program sends an email using MAPI.
| If the program runs from a machine with Outlook 2000, the email was
| sent without any prompt.
| But, if the program runs from a machine with Outlook version later
| than 2000 (like my machine has Outlook 2007), before the email is
| sent, it prompt a message that say "A program is trying to send an e-
| mail message on your behalf. If this is unexpected, click Deny and
| verify your antivirus software is up-to-date. For more information
| about e-mail safety and how you might be able to avoid getting this
| warning, click Help." with buttons "Allo", "Deny" "Help".
|
| I tested by going to my Outlook - Tools - Trust Center - Programmatic
| Access and check "Never warn me about suspicious activity (not
| recommended) ", but still get the prompt.
| Is there anything I can do from my program that will not make the
| prompt to show up ?
|
| Thank you


fiefie.niles

11/17/2010 9:30:00 PM

0

Thank you all for the replies.
This is a different project than the other posting that I posted.
The same problem happened on both VB6 and VB.NET program.
Unfortunately, we can only use MS objects, not 3rd party.


On Nov 17, 3:08 pm, "Mayayana" <mayay...@invalid.nospam> wrote:
> You''re posting to both the VB and the VB.Net group.
> ??
>
>   And didn't you ask about this awhile back? I though
> you started out with Outlook, then there were several
> discussions about less limited ways to send email.
> (Ex.: 9/23  "How do you send an SMTP email with embedded
> image ?")
>
>    Now you're back to using Outlook automation?
>
> | Our VB program sends an email using MAPI.
> | If the program runs from a machine with Outlook 2000, the email was
> | sent without any prompt.
> | But, if the program runs from a machine with Outlook version later
> | than 2000 (like my machine has Outlook 2007), before the email is
> | sent, it prompt a message that say "A program is trying to send an e-
> | mail message on your behalf. If this is unexpected, click Deny and
> | verify your antivirus software is up-to-date. For more information
> | about e-mail safety and how you might be able to avoid getting this
> | warning, click Help." with buttons "Allo", "Deny" "Help".
> |
> | I tested by going to my Outlook - Tools - Trust Center -  Programmatic
> | Access and check "Never warn me about suspicious activity (not
> | recommended) ", but still get the prompt.
> | Is there anything I can do from my program that will not make the
> | prompt to show up ?
> |
> | Thank you

MikeD

11/17/2010 9:53:00 PM

0



"fniles" <fiefie.niles@gmail.com> wrote in message
news:c4807ce2-bb92-46e4-b75a-dac4821e3ae2@w18g2000vbe.googlegroups.com...
> Our VB program sends an email using MAPI.
> If the program runs from a machine with Outlook 2000, the email was
> sent without any prompt.
> But, if the program runs from a machine with Outlook version later
> than 2000 (like my machine has Outlook 2007), before the email is
> sent, it prompt a message that say "A program is trying to send an e-
> mail message on your behalf. If this is unexpected, click Deny and
> verify your antivirus software is up-to-date. For more information
> about e-mail safety and how you might be able to avoid getting this
> warning, click Help." with buttons "Allo", "Deny" "Help".
>
> I tested by going to my Outlook - Tools - Trust Center - Programmatic
> Access and check "Never warn me about suspicious activity (not
> recommended) ", but still get the prompt.
> Is there anything I can do from my program that will not make the
> prompt to show up ?

That was a "feature" added to Outlook beginning, I think, with Outlook 2002.

That is one of the reasons why I personally don't use Outlook for sending
emails. These emails are sent from a Windows Service app that runs 24/7
importing items (sales orders, purchase orders, GL transaction items, etc.)
into ERP software. If errors occur during any of these, an email with an an
error log attached to it is sent to specific persons. That prompt from
Outlook was a major problem. I chose to use CDO, which utilizes an SMTP
server and bypasses MAPI completely. The only complaint some companies have
had is that there's no email in a Sent mailbox. But, that's kind of
ridiculous complaint because they can have the email sent to anyone in their
company they choose. So the email is just in their in box rather than their
sent box. Plus, the error log files are never deleted unless they do so
manually themselves, so they can just open the file if they ever need to.

The only other downside, if you can call it that, is that someone needs to
know and provide the SMTP server name and possibly logon credentials (I've
found that with most companies, if emails are sent only to others within the
company, credentials usually aren't necessary). Those get saved, encrypted,
so they only need entered once during configuration.

CDO is really pretty simple to use. And as I mentioned, you can attach files
to your emails. You can even use HTML to create the email body. There is no
dependency on Outlook or any other MAPI provider, which IMO is another big
plus.

As mentioned, if you really want to continue using Outlook for whatever
reason, Redemption is one solution. But that's yet another ActiveX component
you must distribute and install, adds additional overhead, and STILL has a
dependency on Outlook being installed. There's none of that with CDO as it's
part of Windows.

--
Mike



MikeD

11/17/2010 10:28:00 PM

0



"fniles" <fiefie.niles@gmail.com> wrote in message
news:6b64ecfe-3afb-4fd2-a389-3963ad372a8a@g7g2000vbl.googlegroups.com...
> Thank you all for the replies.
> This is a different project than the other posting that I posted.
> The same problem happened on both VB6 and VB.NET program.
> Unfortunately, we can only use MS objects, not 3rd party.

Then I even more strongly suggest that you consider using CDO. Here's the
function I use. You'll obviously need/want to make some changes to the
code. For example, you may not want to store the settings (smtp server name,
credentials, etc.) in an INI file as I have. You may want to store them in
a database or whatever. You may also not want to verify that a file for
attachment actually exists (if you do, you can just write your own
FileExists function).

The email body, recipient list, and file attachments (can be a string or any
array of strings) get passed to the function. You do not need to specify
any references in VB's References dialog box. The code uses late-binding
for the CDO objects. If you want to use early-binding, however, you could.
I've provided the CDO objects you'd use as comments in the variable
declarations. If you use early-binding, comment out the 2 cdo<x> constants
(the constants, NOT the variables).

This code also represents one of the very FEW times that I'll ever use a
Variant data type. For this function and purpose, it just makes sense though
because it allows for either a single string or an array to be passed for
the file(s) to be attached to the email. Also note that it's an optional
parameter.

-----BEGIN CODE
Public Function SendMailSMTP(ByVal EmailBody As String, ByVal sMailTo As
String, Optional varFileAttachment As Variant) As Boolean

Dim sErrMsg As String
Dim sMailFrom As String
Dim sSMTPServer As String
Dim sSubject As String
Dim sUser As String
Dim sPassword As String
Dim cdoConfig As Object 'CDO.Configuration
Dim cdoMessage As Object 'CDO.Message
Dim sBuffer As String
Dim lBuffer As Long
Dim Index As Long

Const SCHEMA As String =
"http://schemas.microsoft.com/cdo/configurat...
Const cdoSendUsingPort As Long = 2
Const cdoBasic As Long = 1

On Error GoTo EH
lBuffer = 255

'Read email settings from INI file
If Len(Trim$(sMailTo)) = 0 Then
'Only read TO recipients if not passed in
sBuffer = String$(lBuffer, vbNullChar)
Call GetPrivateProfileString("Email", "To", "", sBuffer, lBuffer,
INIFile)
sMailTo = StripNulls(sBuffer)
End If

sBuffer = String$(lBuffer, vbNullChar)
Call GetPrivateProfileString("Email", "From", "Administrator", sBuffer,
lBuffer, INIFile)
sMailFrom = StripNulls(sBuffer)

sBuffer = String$(lBuffer, vbNullChar)
Call GetPrivateProfileString("Email", "SMTPServer", "", sBuffer,
lBuffer, INIFile)
sSMTPServer = StripNulls(sBuffer)

sBuffer = String$(lBuffer, vbNullChar)
GetPrivateProfileString "Email", "UserName", "", sBuffer, lBuffer,
INIFile
sUser = SimpleEncrypt(StripNulls(sBuffer), False)

sBuffer = String$(lBuffer, vbNullChar)
GetPrivateProfileString "Email", "Password", "", sBuffer, lBuffer,
INIFile
sPassword = SimpleEncrypt(StripNulls(sBuffer), False)

sBuffer = String$(lBuffer, vbNullChar)
Call GetPrivateProfileString("Email", "Subject", "SOP Import Error Log",
sBuffer, lBuffer, INIFile)
sSubject = StripNulls(sBuffer)

If (Len(sMailTo) > 0) And (Len(sMailFrom) > 0) And (Len(sSMTPServer) >
0) Then
Set cdoMessage = CreateObject("CDO.Message")

'Create CDO Configuration
Set cdoConfig = CreateObject("CDO.Configuration")

cdoConfig.Fields.Item(SCHEMA & "sendusing") = cdoSendUsingPort
cdoConfig.Fields.Item(SCHEMA & "smtpserver") = sSMTPServer

If Len(sUser) Then
cdoConfig.Fields.Item(SCHEMA & "smtpauthenticate") = cdoBasic
cdoConfig.Fields.Item(SCHEMA & "sendusername") = sUser
cdoConfig.Fields.Item(SCHEMA & "sendpassword") = sPassword
End If

cdoConfig.Fields.Update

With cdoMessage
Set .Configuration = cdoConfig
.To = sMailTo
.From = sMailFrom
.Subject = sSubject
.AutoGenerateTextBody = True
'.TextBody = EmailBody
.HTMLBody = Replace$(EmailBody, vbCrLf, "<BR>")

If Not IsMissing(varFileAttachment) Then
If IsArray(varFileAttachment) Then
For Index = LBound(varFileAttachment) To
UBound(varFileAttachment)
If FileExists(varFileAttachment(Index)) Then
.AddAttachment varFileAttachment(Index)
End If
Next
Else
If FileExists(varFileAttachment) Then
.AddAttachment varFileAttachment
End If
End If
End If

.Send
SendMailSMTP = True
End With
End If

Screen.MousePointer = vbDefault
Exit Function

EH:

Screen.MousePointer = vbDefault

sErrMsg = "The following error was raised in procedure SendMailSMTP." &
vbCrLf & vbCrLf
sErrMsg = sErrMsg & "Error Number: " & Err.Number & vbCrLf
sErrMsg = sErrMsg & "Source: " & Err.Source & vbCrLf
sErrMsg = sErrMsg & "Error Message: " & Err.Description

#If SERVICE = 1 Then
Forms(0).NTS.LogEvent svcEventError, svcMessageError,
"WEBORDER_IMPORT: " & sErrMsg
#Else
MsgBox sErrMsg, vbCritical, App.Title
#End If

SendMailSMTP = False

End Function
-----END CODE

Perhaps this one function can solve all your email problems that you've
lately been posting.

--
Mike


Tony Toews

11/17/2010 10:36:00 PM

0

On Wed, 17 Nov 2010 16:53:27 -0500, "MikeD" <nobody@nowhere.edu>
wrote:

>The only complaint some companies have
>had is that there's no email in a Sent mailbox. But, that's kind of
>ridiculous complaint because they can have the email sent to anyone in their
>company they choose. So the email is just in their in box rather than their
>sent box. Plus, the error log files are never deleted unless they do so
>manually themselves, so they can just open the file if they ever need to.

I always log the emails sent in some fashion. If they aren't already
part of an error handling system which is already logged.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/ac...
Tony's Microsoft Access Blog - http://msmvps.com/blo...
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeup...

MikeD

11/17/2010 11:32:00 PM

0



"Tony Toews" <ttoews@telusplanet.net> wrote in message
news:a5m8e6lsnrsapnqr7opiidb6r1f7i1tp0n@4ax.com...
> On Wed, 17 Nov 2010 16:53:27 -0500, "MikeD" <nobody@nowhere.edu>
> wrote:
>
>>The only complaint some companies have
>>had is that there's no email in a Sent mailbox. But, that's kind of
>>ridiculous complaint because they can have the email sent to anyone in
>>their
>>company they choose. So the email is just in their in box rather than
>>their
>>sent box. Plus, the error log files are never deleted unless they do so
>>manually themselves, so they can just open the file if they ever need to.
>
> I always log the emails sent in some fashion. If they aren't already
> part of an error handling system which is already logged.

What do you mean?

What I'm getting at is that the purpose of the email is NOTHING more than
sending an error log file, which is saved on THEIR system and they have
access to. Why does there need to be a record (in the form of a sent email)
that an email of the error log was sent?

Or are you talking about something else?

I really don't know what you were getting at with your reply.

--
Mike


Tony Toews

11/18/2010 4:45:00 AM

0

On Wed, 17 Nov 2010 18:31:46 -0500, "MikeD" <nobody@nowhere.edu>
wrote:

>> I always log the emails sent in some fashion. If they aren't already
>> part of an error handling system which is already logged.
>
>What do you mean?
>
>What I'm getting at is that the purpose of the email is NOTHING more than
>sending an error log file, which is saved on THEIR system and they have
>access to. Why does there need to be a record (in the form of a sent email)
>that an email of the error log was sent?
>
>Or are you talking about something else?
>
>I really don't know what you were getting at with your reply.

My sentence was not clear. I have two different situations in very
different types of applications.

1) As you are doing an email can be optionally sent if an error
occurs. I agree that no log is required.

2) I have a membership application for a club which does 95% of it's
renewals via email. I also send out email notices of meetings, URL
of newsletters and other items of general interest to the membershipo.
(Those few who don't have email addresses get a snail mail renewal
reminder and that's it.)

All those kinds of emails I log so that if there's ever any question I
can respond stating "I sent this email at this date/time to that email
address."

There have been several questions over the years from folks wondering
why they didn't get a renewal reminder. Turns out that they had
moved, changed email addresses and their old phone number no longer
worked. And a few other misc questions.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/ac...
Tony's Microsoft Access Blog - http://msmvps.com/blo...
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeup...