Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sendmail with custom subject and body fields

Posted on 2007-03-25
13
Medium Priority
?
435 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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