?
Solved

Sendmail with custom subject and body fields

Posted on 2007-03-25
13
Medium Priority
?
432 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
Technology Partners: 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 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