×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Getting an agent to email form contents and attachments

Getting an agent to email form contents and attachments

Getting an agent to email form contents and attachments

(OP)
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

RE: Getting an agent to email form contents and attachments

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

RE: Getting an agent to email form contents and attachments

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close