A program is trying to send mail using Item.Send

S

Stapes

Hi
I am trying to send a load of emails when my user closes a form. At
the moment, the system puts up an error message for each individual
email requiring a yes/no response:

A program is trying to automatically send e-mail on your behalf.
Do you want to allow this?

If this is unexpected, it may be a virus and you should choose "No".

Is there any way I can stop this happening, preferably without having
to interfere with the clients Outlook settings?

I tried setting EditMessage to True. This stopped the above message
coming out, but the required the user to press Ctrl and Enter to send
each message.

Stapes
 
D

Douglas J. Steele

Stapes said:

It all depends on what's generating the security message you're seeing. If
you're using Outlook (as opposed to Outlook Express or Lotus Notes or some
other mail client), then that link is one approach to get around the Outlook
message.
 
G

Guest

Stapes,

I would suggest using the following function to send emails. This does not
activate the security questions, just sends the email silently and on any
computer regardless of the default email program. All you need to change is
the dollar signs to a known out going mail server.

HTH Rico

Public Function sendCDOEmail(txtFrom As String, _
txtTo As String, _
txtSubject As String, _
txtBody As String, _
strAttachment As String)

Const cdoSendUsingPort = 2
Const cdoBasic = 1

Dim objCDOConfig As Object
Dim objCDOMessage As Object
Dim objattachment As Object
Dim strSch As String


strSch = "http://schemas.microsoft.com/cdo/configuration/"

Set objCDOConfig = CreateObject("CDO.Configuration")

With objCDOConfig.Fields
.item(strSch & "sendusing") = cdoSendUsingPort
.item(strSch & "smtpserver") = "$$$$$$$$$$"
.item(strSch & "SMTPAuthenticate") = cdoBasic


.Update

End With



Set objCDOMessage = CreateObject("CDO.Message")

With objCDOMessage

Set .Configuration = objCDOConfig

.FROM = txtFrom
.Sender = txtFrom
.To = txtTo
.cc = SendCc
.Subject = txtSubject
.TextBody = txtBody

Set objattachment = objCDOMessage.AddAttachment(strAttachment) 'Attach
object given by strAttachment

.send 'Send
Email

End With

Set objCDOMessage = Nothing
Set objCDOConfig = Nothing

End Function
 
R

Rick Brandt

Haze1023 said:
How does this work?

The CDOSys messaging library is another way to send email messages and it is
included automatically on Windows 2000 and higher.

It has no mechanism to show the user the message before sending and you
don't get a copy in your Outlook Sent mail folder, but when those are not
required you can use CDOSys to send any kind of Email that can include file
attachments and you can send plain text or HTML formatted messages with it.
 

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