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!

Getting an agent to email form contents and attachments

Status
Not open for further replies.

kjc7

Programmer
Dec 15, 2003
2
0
0
GB
Hello,

I have created a form that allows a user to insert information and upload an attachment.
The webquerysave then calls an agent which then sends the contents of the form to an email. What I also want to do is to send the uploaded file as an attachment.
Does anyone have any idea on how to do this.

I have tried
Call doc.send(False,emailArray)
and
docmail.send(False)


doc.send sends the attachment but not the form
docmail.send sends a link to the form in the database and the attachment can then be downloaded there.


The code I have used is :

Sub Initialize
Dim sess As New notessession
Dim db As notesdatabase
Set db = sess.currentdatabase
Dim doc As notesdocument
Dim docmail As New notesdocument(db)
Dim rtitem As New notesrichtextitem(docmail, "Body")
Dim selectedoption As String

Dim emailSubject As String 'the email subject

On Error Resume Next
Set doc = sess.documentcontext

Dim emailArray() As String


selectedoption = doc.piCommodityArea(0)

If selectedoption = "Maintenance" Then
Redim emailArray(1)
emailArray(0) = "Joe Bloggs"
emailSubject = "Main"
End If

doc.form = "memo"
doc.SendTo = emailArray
doc.from = doc.From(0)
doc.subject = emailSubject

Call rtitem.appendtext("Name - " & doc.piName(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("Email - " & doc.piEmail(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("Telephone - " & doc.piTelephone(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("Commodity Area - " & doc.piCommodityArea(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("Commodity Description - " & doc.piCommodityDescription(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("Approximate Expenditure - " & doc.ApproximateExpenditure(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("This is for - " & doc.piTimePeriod(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appenddoclink(doc,"This is the attachment")
Call rtitem.appendtext(emailMessage)
Call doc.send(False,emailArray)
'docmail.send(False)

End Sub


Any help greatly appreaciated. I am quite new at this
 
doc.send sends the attachment but not the form

a form in Lotus Notes is an internal object used to view a document that is stored in the database. You can't mail the "form".

If you're trying to do something different, re-post.

Leslie

 
Well I want to send both. I have got the docmail.send to send the details of the form., and i have got the doc.send to send the attachment. But these are sent as separate emails. What I want to be able to do is send an email which contains all the entries of the form and the uploaded file as an attachment.

I don't want to actually send the form, just the values that were entered:

This seems to add the values to the email:
Call rtitem.appendtext("Name - " & doc.piName(0) )
Call rtitem.AddNewLine( 2 )
Call rtitem.appendtext("Email - " & doc.piEmail(0) )
Call rtitem.AddNewLine( 2 )

Any ideas how to do this?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top