Solved

Sendmail with custom subject and body fields

Posted on 2007-03-25
13
427 Views
Last Modified: 2013-12-18
Hi,

I've been send email a doclink with some details from the form to specified users with specific subject text using:
@MailSend("SentToperon";"CC peron";"BCC Person";"Subject Text";"Remark";field_from_form;[IncludeDoclink])

I would like to be able to customize the Subject with the value of a field on the form instead of static text.  

Can someone please help.  Thank you.
0
Comment
Question by:hu8mypho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
13 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 18791245
Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Dim doc As NotesDocument
      Set db = session.CurrentDatabase
      Set doc = New NotesDocument(db)
Dim maildoc As notesdocument
                  Dim Body As NotesRichTextItem
                  Dim object As NotesEmbeddedObject
Set maildoc = New NotesDocument( db )
                  maildoc.Form = "Memo"
                  maildoc.Subject = curdoc.sub_x(0) 'Your Subject from current document
maildoc.SendTo = "email here" '<< change this
Set Body=New NotesRichTextItem(maildoc,"Body")
Set tmpvar=curdoc.getfirstitem("Body") 'Current documents RTF Field
Call Body.AppendRTItem(tmpvar)
Call Body.AddNewLine(2)
Call maildoc.send(False)
0
 
LVL 1

Author Comment

by:hu8mypho
ID: 18792049
hi,

I'm getting "Variant does not contain an object"  at:

maildoc.Subject = curdoc.text(0) 'Your Subject from current document
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 18792147
sorry  curdoc is not declared
Dim session As New NotesSession
      Dim db As NotesDatabase
dim ws as new notesuiworkspace
      Dim view As NotesView
      Dim doc As NotesDocument, curdoc as notesdocument
set curdoc=ws.currentdocument.document
      Set db = session.CurrentDatabase
      Set doc = New NotesDocument(db)
Dim maildoc As notesdocument
                  Dim Body As NotesRichTextItem
                  Dim object As NotesEmbeddedObject
Set maildoc = New NotesDocument( db )
                  maildoc.Form = "Memo"
                  maildoc.Subject = curdoc.sub_x(0) 'Your Subject from current document
maildoc.SendTo = "email here" '<< change this
Set Body=New NotesRichTextItem(maildoc,"Body")
Set tmpvar=curdoc.getfirstitem("Body") 'Current documents RTF Field
Call Body.AppendRTItem(tmpvar)
Call Body.AddNewLine(2)
Call maildoc.send(False)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 20 total points
ID: 18792538
The subject parameter can be an expression. So, instead of the fixed text, you can use fields as well, but only from the current document.

Example:

@MailSend("SentToperon";"CC peron";"BCC Person"; SubjectField; "Remark";field_from_form;[IncludeDoclink])
0
 
LVL 1

Author Comment

by:hu8mypho
ID: 18792646
I was able to step through further this time but is getting type mismatch at :

Call Body.AppendRTItem(tmpvar)

0
 
LVL 19

Expert Comment

by:madheeswar
ID: 18792664
I apolozise for the mistake.
Dim session As New NotesSession
      Dim db As NotesDatabase
dim ws as new notesuiworkspace
      Dim view As NotesView
      Dim doc As NotesDocument, curdoc as notesdocument
set curdoc=ws.currentdocument.document
      Set db = session.CurrentDatabase
      Set doc = New NotesDocument(db)
Dim maildoc As notesdocument
                  Dim Body As NotesRichTextItem
                  Dim object As NotesEmbeddedObject
Set maildoc = New NotesDocument( db )
                  maildoc.Form = "Memo"
                  maildoc.Subject = curdoc.sub_x(0) 'Your Subject from current document
maildoc.SendTo = "email here" '<< change this
Set Body=New NotesRichTextItem(maildoc,"Body")
dim tmpvar as variant
Set tmpvar=curdoc.getfirstitem("Body") 'Current documents RTF Field
Call Body.AppendRTItem(tmpvar)
Call Body.AddNewLine(2)
Call maildoc.send(False)
0
 
LVL 1

Author Comment

by:hu8mypho
ID: 18792720
sjef,

strange, i actually tried that method before and received a note with a blank subject, but i was able to get it to work this time.... cheers :-)

madheeswar,

I would still like to get the script version working, would you please continue helping I will split points :-).  Thank you both.
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 18792740
Now what is the problem?
Also, I need 90% of points.
Sjef,
Pls don't mind..

:)
0
 
LVL 1

Author Comment

by:hu8mypho
ID: 18792847
I'm still getting type mismatch at the same location:

Call Body.AppendRTItem(tmpvar)
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 480 total points
ID: 18792953
use below:
Dim tmpvar As NotesRichTextItem 'Use this.

Also a sample code:Which is working:
Sub Click(Source As Button)
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim mdoc As NotesDocument
Dim docRT As NotesRichTextItem
Dim mdocRT As NotesRichTextItem
Set uidoc = w.CurrentDocument
Set doc = uidoc.Document
Set docRT = _
doc.GetFirstItem("Body")
Set db = s.CurrentDatabase
Set mdoc = db.CreateDocument
mdoc.Form = "Memo"
mdoc.SendTo = s.UserName
mdoc.Subject = _
"Some rich-text mailed to you"
Set mdocRT = _
mdoc.CreateRichTextItem("Body")
Call mdocRT.AppendRTItem(docRT)
Call mdoc.Send(False)
Messagebox("OK, now go look + _
in your mail")
End Sub
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 18798397
Ah, Maddy, in need of points, end of the month approaching?? You can have them all. :-)
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 18798410
Yes... EOM.
BTW, how are you doing? No emails these days?
0
 
LVL 1

Author Comment

by:hu8mypho
ID: 18799709
Thanks for your help guys.

I still couldn't quite get the script working yet, but will use the working code to bebug mines.  I have a more intriguing question today will post soon.  :-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question