auto email not working

G

Guest

I have put in code to auto email using my lotus notes. Everything works
(when clicked, lotus notes opens, attachment goes in, "To" and "Subject"
fields fills out) except it will not automatically send the email. I put in
"false" but that is not working. I wrote a macro and put in "no" for edit
message and still it will not automatically send the email. I have to click
on the send button. Is there more code I need to make Lotus Notes send
without having to click on the send button?

Thanks.
 
A

Arvin Meyer [MVP]

ELL said:
I have put in code to auto email using my lotus notes. Everything works
(when clicked, lotus notes opens, attachment goes in, "To" and "Subject"
fields fills out) except it will not automatically send the email. I put
in
"false" but that is not working. I wrote a macro and put in "no" for edit
message and still it will not automatically send the email. I have to
click
on the send button. Is there more code I need to make Lotus Notes send
without having to click on the send button?

I didn't originally write this code, but I adapted it several years ago to
send email and it worked just fine:

Global NotesSession As Object
Global NotesMaildb As Object
Global NotesMailDoc As Object
Global NotesFileAttachment As Object
Global NotesRichTextItem As Object
Global NotesItem As Object

' Initialize Notes Objects

Set NotesSession = CreateObject("Notes.NotesSession")
'Set NotesMaildb = NotesSession.GetDatabase("SIN_MAIL_01",
"mail\KVENUGOP.nsf")
Set NotesMaildb = NotesSession.GetDatabase("", "")
NotesMaildb.OpenMail


'Put the following in a subroutine:

Sub SendMail()
On Error GoTo Error_Handler

Set NotesMailDoc = NotesMaildb.CreateDocument

'Function syntax - EmbedObject(type, Class, source, [name])
'Set NotesFileAttachment = NotesRichTextItem.EmbedObject(0, "",
"C:\Test.htm")

NotesMailDoc.SaveMessageOnSend = True
NotesMailDoc.SendTo = "(e-mail address removed)"
NotesMailDoc.from = NotesSession.UserName
NotesMailDoc.Subject = "Test mail"
NotesMailDoc.Body = "This is a sample mail to check the OLE
functionality to send mail. _
This mail has a file attached."
NotesMailDoc.Send

Exit_Here:
Set NotesView = Nothing
Set NotesMaildb = Nothing
Set NotesSession = Nothing
Set NotesMailDoc = Nothing
Set NotesFileAttachment = Nothing
Set NotesRichTextItem = Nothing
Exit Sub
Error_Handler:
MsgBox "This email was not sent", vbOKOnly, "Error"
Resume Exit_Here
End Sub
 
G

Guest

Do I put this in a command button code or somewhere else. I am a bit of a
novice and have been trying to figure out how to do this for several months.
All code I have been using i have found on the internet. I just need a
little help understanding how to input your code. Thanks.
--
ELL


Arvin Meyer said:
ELL said:
I have put in code to auto email using my lotus notes. Everything works
(when clicked, lotus notes opens, attachment goes in, "To" and "Subject"
fields fills out) except it will not automatically send the email. I put
in
"false" but that is not working. I wrote a macro and put in "no" for edit
message and still it will not automatically send the email. I have to
click
on the send button. Is there more code I need to make Lotus Notes send
without having to click on the send button?

I didn't originally write this code, but I adapted it several years ago to
send email and it worked just fine:

Global NotesSession As Object
Global NotesMaildb As Object
Global NotesMailDoc As Object
Global NotesFileAttachment As Object
Global NotesRichTextItem As Object
Global NotesItem As Object

' Initialize Notes Objects

Set NotesSession = CreateObject("Notes.NotesSession")
'Set NotesMaildb = NotesSession.GetDatabase("SIN_MAIL_01",
"mail\KVENUGOP.nsf")
Set NotesMaildb = NotesSession.GetDatabase("", "")
NotesMaildb.OpenMail


'Put the following in a subroutine:

Sub SendMail()
On Error GoTo Error_Handler

Set NotesMailDoc = NotesMaildb.CreateDocument

'Function syntax - EmbedObject(type, Class, source, [name])
'Set NotesFileAttachment = NotesRichTextItem.EmbedObject(0, "",
"C:\Test.htm")

NotesMailDoc.SaveMessageOnSend = True
NotesMailDoc.SendTo = "(e-mail address removed)"
NotesMailDoc.from = NotesSession.UserName
NotesMailDoc.Subject = "Test mail"
NotesMailDoc.Body = "This is a sample mail to check the OLE
functionality to send mail. _
This mail has a file attached."
NotesMailDoc.Send

Exit_Here:
Set NotesView = Nothing
Set NotesMaildb = Nothing
Set NotesSession = Nothing
Set NotesMailDoc = Nothing
Set NotesFileAttachment = Nothing
Set NotesRichTextItem = Nothing
Exit Sub
Error_Handler:
MsgBox "This email was not sent", vbOKOnly, "Error"
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
A

Arvin Meyer [MVP]

You'll need to make sure that your references to Notes are in order (hint:
look on any modulemenubar for Tools ... References) then make sure the one
for Notes is checked. Your command button code might look something like
this (Add error handling):

Sub cmdSendNotesMail_Click()
SendMail
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ELL said:
Do I put this in a command button code or somewhere else. I am a bit of a
novice and have been trying to figure out how to do this for several
months.
All code I have been using i have found on the internet. I just need a
little help understanding how to input your code. Thanks.
--
ELL


Arvin Meyer said:
ELL said:
I have put in code to auto email using my lotus notes. Everything works
(when clicked, lotus notes opens, attachment goes in, "To" and
"Subject"
fields fills out) except it will not automatically send the email. I
put
in
"false" but that is not working. I wrote a macro and put in "no" for
edit
message and still it will not automatically send the email. I have to
click
on the send button. Is there more code I need to make Lotus Notes send
without having to click on the send button?

I didn't originally write this code, but I adapted it several years ago
to
send email and it worked just fine:

Global NotesSession As Object
Global NotesMaildb As Object
Global NotesMailDoc As Object
Global NotesFileAttachment As Object
Global NotesRichTextItem As Object
Global NotesItem As Object

' Initialize Notes Objects

Set NotesSession = CreateObject("Notes.NotesSession")
'Set NotesMaildb = NotesSession.GetDatabase("SIN_MAIL_01",
"mail\KVENUGOP.nsf")
Set NotesMaildb = NotesSession.GetDatabase("", "")
NotesMaildb.OpenMail


'Put the following in a subroutine:

Sub SendMail()
On Error GoTo Error_Handler

Set NotesMailDoc = NotesMaildb.CreateDocument

'Function syntax - EmbedObject(type, Class, source, [name])
'Set NotesFileAttachment = NotesRichTextItem.EmbedObject(0, "",
"C:\Test.htm")

NotesMailDoc.SaveMessageOnSend = True
NotesMailDoc.SendTo = "(e-mail address removed)"
NotesMailDoc.from = NotesSession.UserName
NotesMailDoc.Subject = "Test mail"
NotesMailDoc.Body = "This is a sample mail to check the OLE
functionality to send mail. _
This mail has a file attached."
NotesMailDoc.Send

Exit_Here:
Set NotesView = Nothing
Set NotesMaildb = Nothing
Set NotesSession = Nothing
Set NotesMailDoc = Nothing
Set NotesFileAttachment = Nothing
Set NotesRichTextItem = Nothing
Exit Sub
Error_Handler:
MsgBox "This email was not sent", vbOKOnly, "Error"
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
G

Guest

Thank you for your help. I did not know about the References. I checked the
"Lotus Notes Automation Classes" and "Lotus Domino Objects". Then used a
command button with this code:

Private Sub Command57_Click()
On Error GoTo Err_Command57_Click
Dim stDocName As String
stDocName = "94 Management Assessment"
DoCmd.SendObject acSendReport, "94 Management Assessment", "Snapshot",
"(e-mail address removed)", , , "Subject", "Message Text", False
Exit_Command57_Click:
Exit Sub
Err_Command57_Click:
MsgBox Err.Description
Resume Exit_Command57_Click
End Sub

It will open lotus notes, create a document, attach report but it does not
send the email. I still have to physically click it. Am I still missing
something?
--
ELL


Arvin Meyer said:
You'll need to make sure that your references to Notes are in order (hint:
look on any modulemenubar for Tools ... References) then make sure the one
for Notes is checked. Your command button code might look something like
this (Add error handling):

Sub cmdSendNotesMail_Click()
SendMail
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ELL said:
Do I put this in a command button code or somewhere else. I am a bit of a
novice and have been trying to figure out how to do this for several
months.
All code I have been using i have found on the internet. I just need a
little help understanding how to input your code. Thanks.
--
ELL


Arvin Meyer said:
I have put in code to auto email using my lotus notes. Everything works
(when clicked, lotus notes opens, attachment goes in, "To" and
"Subject"
fields fills out) except it will not automatically send the email. I
put
in
"false" but that is not working. I wrote a macro and put in "no" for
edit
message and still it will not automatically send the email. I have to
click
on the send button. Is there more code I need to make Lotus Notes send
without having to click on the send button?

I didn't originally write this code, but I adapted it several years ago
to
send email and it worked just fine:

Global NotesSession As Object
Global NotesMaildb As Object
Global NotesMailDoc As Object
Global NotesFileAttachment As Object
Global NotesRichTextItem As Object
Global NotesItem As Object

' Initialize Notes Objects

Set NotesSession = CreateObject("Notes.NotesSession")
'Set NotesMaildb = NotesSession.GetDatabase("SIN_MAIL_01",
"mail\KVENUGOP.nsf")
Set NotesMaildb = NotesSession.GetDatabase("", "")
NotesMaildb.OpenMail


'Put the following in a subroutine:

Sub SendMail()
On Error GoTo Error_Handler

Set NotesMailDoc = NotesMaildb.CreateDocument

'Function syntax - EmbedObject(type, Class, source, [name])
'Set NotesFileAttachment = NotesRichTextItem.EmbedObject(0, "",
"C:\Test.htm")

NotesMailDoc.SaveMessageOnSend = True
NotesMailDoc.SendTo = "(e-mail address removed)"
NotesMailDoc.from = NotesSession.UserName
NotesMailDoc.Subject = "Test mail"
NotesMailDoc.Body = "This is a sample mail to check the OLE
functionality to send mail. _
This mail has a file attached."
NotesMailDoc.Send

Exit_Here:
Set NotesView = Nothing
Set NotesMaildb = Nothing
Set NotesSession = Nothing
Set NotesMailDoc = Nothing
Set NotesFileAttachment = Nothing
Set NotesRichTextItem = Nothing
Exit Sub
Error_Handler:
MsgBox "This email was not sent", vbOKOnly, "Error"
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
A

Arvin Meyer [MVP]

No, you're not missing anything. The last argument in the SendObject code
should just send it without opening. Setting it to True will open it. I'd
set a stop (breakpoint) at that line, then step 1 step and check the values.
If they are OK, it's a problem with Lotus Notes.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ELL said:
Thank you for your help. I did not know about the References. I checked
the
"Lotus Notes Automation Classes" and "Lotus Domino Objects". Then used a
command button with this code:

Private Sub Command57_Click()
On Error GoTo Err_Command57_Click
Dim stDocName As String
stDocName = "94 Management Assessment"
DoCmd.SendObject acSendReport, "94 Management Assessment", "Snapshot",
"(e-mail address removed)", , , "Subject", "Message Text", False
Exit_Command57_Click:
Exit Sub
Err_Command57_Click:
MsgBox Err.Description
Resume Exit_Command57_Click
End Sub

It will open lotus notes, create a document, attach report but it does not
send the email. I still have to physically click it. Am I still missing
something?
--
ELL


Arvin Meyer said:
You'll need to make sure that your references to Notes are in order
(hint:
look on any modulemenubar for Tools ... References) then make sure the
one
for Notes is checked. Your command button code might look something like
this (Add error handling):

Sub cmdSendNotesMail_Click()
SendMail
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ELL said:
Do I put this in a command button code or somewhere else. I am a bit
of a
novice and have been trying to figure out how to do this for several
months.
All code I have been using i have found on the internet. I just need a
little help understanding how to input your code. Thanks.
--
ELL


:

I have put in code to auto email using my lotus notes. Everything
works
(when clicked, lotus notes opens, attachment goes in, "To" and
"Subject"
fields fills out) except it will not automatically send the email.
I
put
in
"false" but that is not working. I wrote a macro and put in "no"
for
edit
message and still it will not automatically send the email. I have
to
click
on the send button. Is there more code I need to make Lotus Notes
send
without having to click on the send button?

I didn't originally write this code, but I adapted it several years
ago
to
send email and it worked just fine:

Global NotesSession As Object
Global NotesMaildb As Object
Global NotesMailDoc As Object
Global NotesFileAttachment As Object
Global NotesRichTextItem As Object
Global NotesItem As Object

' Initialize Notes Objects

Set NotesSession = CreateObject("Notes.NotesSession")
'Set NotesMaildb = NotesSession.GetDatabase("SIN_MAIL_01",
"mail\KVENUGOP.nsf")
Set NotesMaildb = NotesSession.GetDatabase("", "")
NotesMaildb.OpenMail


'Put the following in a subroutine:

Sub SendMail()
On Error GoTo Error_Handler

Set NotesMailDoc = NotesMaildb.CreateDocument

'Function syntax - EmbedObject(type, Class, source, [name])
'Set NotesFileAttachment = NotesRichTextItem.EmbedObject(0, "",
"C:\Test.htm")

NotesMailDoc.SaveMessageOnSend = True
NotesMailDoc.SendTo = "(e-mail address removed)"
NotesMailDoc.from = NotesSession.UserName
NotesMailDoc.Subject = "Test mail"
NotesMailDoc.Body = "This is a sample mail to check the OLE
functionality to send mail. _
This mail has a file attached."
NotesMailDoc.Send

Exit_Here:
Set NotesView = Nothing
Set NotesMaildb = Nothing
Set NotesSession = Nothing
Set NotesMailDoc = Nothing
Set NotesFileAttachment = Nothing
Set NotesRichTextItem = Nothing
Exit Sub
Error_Handler:
MsgBox "This email was not sent", vbOKOnly, "Error"
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
G

Guest

I figured out the problem. It was a lotus notes problem. Now everything
works. Thanks for your help!!!
--
ELL


Arvin Meyer said:
No, you're not missing anything. The last argument in the SendObject code
should just send it without opening. Setting it to True will open it. I'd
set a stop (breakpoint) at that line, then step 1 step and check the values.
If they are OK, it's a problem with Lotus Notes.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

ELL said:
Thank you for your help. I did not know about the References. I checked
the
"Lotus Notes Automation Classes" and "Lotus Domino Objects". Then used a
command button with this code:

Private Sub Command57_Click()
On Error GoTo Err_Command57_Click
Dim stDocName As String
stDocName = "94 Management Assessment"
DoCmd.SendObject acSendReport, "94 Management Assessment", "Snapshot",
"(e-mail address removed)", , , "Subject", "Message Text", False
Exit_Command57_Click:
Exit Sub
Err_Command57_Click:
MsgBox Err.Description
Resume Exit_Command57_Click
End Sub

It will open lotus notes, create a document, attach report but it does not
send the email. I still have to physically click it. Am I still missing
something?
--
ELL


Arvin Meyer said:
You'll need to make sure that your references to Notes are in order
(hint:
look on any modulemenubar for Tools ... References) then make sure the
one
for Notes is checked. Your command button code might look something like
this (Add error handling):

Sub cmdSendNotesMail_Click()
SendMail
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Do I put this in a command button code or somewhere else. I am a bit
of a
novice and have been trying to figure out how to do this for several
months.
All code I have been using i have found on the internet. I just need a
little help understanding how to input your code. Thanks.
--
ELL


:

I have put in code to auto email using my lotus notes. Everything
works
(when clicked, lotus notes opens, attachment goes in, "To" and
"Subject"
fields fills out) except it will not automatically send the email.
I
put
in
"false" but that is not working. I wrote a macro and put in "no"
for
edit
message and still it will not automatically send the email. I have
to
click
on the send button. Is there more code I need to make Lotus Notes
send
without having to click on the send button?

I didn't originally write this code, but I adapted it several years
ago
to
send email and it worked just fine:

Global NotesSession As Object
Global NotesMaildb As Object
Global NotesMailDoc As Object
Global NotesFileAttachment As Object
Global NotesRichTextItem As Object
Global NotesItem As Object

' Initialize Notes Objects

Set NotesSession = CreateObject("Notes.NotesSession")
'Set NotesMaildb = NotesSession.GetDatabase("SIN_MAIL_01",
"mail\KVENUGOP.nsf")
Set NotesMaildb = NotesSession.GetDatabase("", "")
NotesMaildb.OpenMail


'Put the following in a subroutine:

Sub SendMail()
On Error GoTo Error_Handler

Set NotesMailDoc = NotesMaildb.CreateDocument

'Function syntax - EmbedObject(type, Class, source, [name])
'Set NotesFileAttachment = NotesRichTextItem.EmbedObject(0, "",
"C:\Test.htm")

NotesMailDoc.SaveMessageOnSend = True
NotesMailDoc.SendTo = "(e-mail address removed)"
NotesMailDoc.from = NotesSession.UserName
NotesMailDoc.Subject = "Test mail"
NotesMailDoc.Body = "This is a sample mail to check the OLE
functionality to send mail. _
This mail has a file attached."
NotesMailDoc.Send

Exit_Here:
Set NotesView = Nothing
Set NotesMaildb = Nothing
Set NotesSession = Nothing
Set NotesMailDoc = Nothing
Set NotesFileAttachment = Nothing
Set NotesRichTextItem = Nothing
Exit Sub
Error_Handler:
MsgBox "This email was not sent", vbOKOnly, "Error"
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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