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
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