Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate email in Lotus Notes 1

Status
Not open for further replies.

jthoe

Technical User
Mar 25, 2008
4
0
0
US
I would like to automate an Lotus Notes email sent out after clicking an command button in a form. Currently I have a Macro set up to Send object as an attachment. Nothing gets populated in the To or CC fields. The email gets created in Notes but I have to then put in the email address and send. I would like it to default to the email already set up in the related vendor table and send out automatically.

Any ideas would be greatly appreciated?

 
This may be of some use:

Sub Main()
Dim oSess As Object ' NotesSession
Dim oDB As Object ' NotesDatabase
Dim oDoc As Object ' NotesDocument
Dim oItem As Object ' NotesRichTextItem

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("ServerName/Servers/Folder", "mail\edmetcalfe.nsf")

Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "Example E-mail"
oDoc.sendto = "somebody@acompany.com"
oDoc.body = "This is test text in the body of the email"

Call oItem.EMBEDOBJECT(1454, "", "C:\Test.txt")
oDoc.visable = True

Call oDoc.Save(False, False)
Call oDoc.PUTINFOLDER("Drafts")


Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
End Sub

Ed Metcalfe.

Please do not feed the trolls.....
 
Ed2020

Thanks for responding so quickly.

I apologize for asking but I'm not very good at coding. Where do I put this coding? I tried adding to the excisting coding set up for command 85.(See below) How do I intergrate your coding to the excisting?

Thanks!

Private Sub Command85_Click()
On Error GoTo Err_Command85_Click

Dim stDocName As String

stDocName = "Send Email deductions"
DoCmd.RunMacro stDocName

Exit_Command85_Click:
Exit Sub

Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click

End Sub

 
Let me know, how this comes out. I too would like to acconplish this task.

All though mine would be a little more complex.

I have a report that goes out everyday. I have a date field when the report goes to various user's.

I would like to have it when the user logs into the database on that particular date, the report goes to that user, of course I would only like it to go only one time per day.

I have only been working off and on for about month on this.

I know there is some guru, can accomplish this, but I know I sure can't.

 
Somthing like this should work:

Code:
Private Sub Command85_Click()
On Error GoTo Err_Command85_Click

    Call Main()

Exit_Command85_Click:
    Exit Sub

Err_Command85_Click:
    MsgBox Err.Description
    Resume Exit_Command85_Click
    
End Sub

You will need to amend the references to specific server addresses (Set oDB = oSess.GETDATABASE("ServerName/Servers/Folder", "mail\edmetcalfe.nsf")) and also the path to your file attachment.

Currently this code only creates the email and saves it in your Drafts folder. It should be easy enough to amend it to send the email. Let me know if you need any assistance with this and I'll see if I can figure it out.

Ed Metcalfe

Please do not feed the trolls.....
 
Ed, thanks for the input. I maybe over step the boundry here. As you can see, my request is a little different and little more complex. If you can give me any insight on just how to make this happen, it would be great.

Looking forward to here your responce.
 
Joe,

The code I have posted for actually sending the email should work in the same way for your requirements, however it sounds like you have some unanswered questions about the generation of the daily report. It would probably be worthwhile starting a new thread and providing as much background information as possible. I'm sure that there are plenty of people here who would be happy to help - I'll certainly do my best!

Ed Metcalfe.

Please do not feed the trolls.....
 
Ed2020,

I guess I'm going to need your assistance on this. I'm a little bit out of my league on this and would greatly appreciate any assistance on this.

How do I get the server adresses?

Do I incorporate the 2 codings you provided me? What does this look like?

Thanks!!

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top