Email code to specific recipient

N

Neil Greenough

I have a form for different contacts. The form contains a field for the
email address for each contact. This field is called "ABC."

Now, on this form, I want to click on a button and for an email to be
automatically created for the email address in that form, so if I am looking
at Joe Bloggs, who is joebloggs@hotmail, when I click the button, an email
automatically opens adressed automatically to joebloggs@hotmail.

I am using Lotus Notes.

So far, I have the following code. Could you confirm this is the complete
code I should put behind the button? Also, could you please alter the code,
so it copies the info from the field 'ABC', so as to automatically address
the email?

Thanks
___________________________________

Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
Set notessession = CreateObject("Notes.Notessession")
Set notesdb = notessession.getdatabase("", "")
Call notesdb.openmail
Rem make new mail message
Set notesdoc = notesdb.createdocument
Call notesdoc.replaceitemvalue("Sendto", strSupportEMail)
Call notesdoc.replaceitemvalue("Subject", "Problem Report")
Set notesrtf = notesdoc.createrichtextitem("body")
Call notesrtf.appendtext("Problem Report")
Call notesrtf.addnewline(2)
Rem attach Error Report doc
's = ActiveDocument.Path + "\" + ActiveDocument.Name
Call notesrtf.embedObject(1454, "", strCurrentPath, "Mail.rtf")
Rem send message
Call notesdoc.Send(False)
Set notessession = Nothing
 
A

Alex Dybenko

Hi,
if you put this code in a module behind the form, then this line:

Call notesdoc.replaceitemvalue("Sendto", strSupportEMail)

should be:

Call notesdoc.replaceitemvalue("Sendto", me!ABC)

where ABC is a field with email of current address on same form
 

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