?
Solved

Sendmail with custom subject and body fields

Posted on 2007-03-25
13
Medium Priority
?
442 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 80 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 1920 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

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!

Question has a verified solution.

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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

809 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