Solved

Sendmail with custom subject and body fields

Posted on 2007-03-25
13
410 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now