Solved

Using fancy fonts and spacings in @mailsend

Posted on 2006-06-18
11
746 Views
Last Modified: 2013-12-18
Hello experts.  Does anyone know if there is anyway to pretty up the fonts and add spaces to the bodytext in a mailsend.  I know how to send a rich text field, but in this instance I want to send a text message which has bolded words, and is spaced neatly to help the recipient.  Judging from the help and my experience, whatever text you put into the body of the message is just plain word wrapping text.  Is there anything I can do, even some kind of simple codes I can use, to bold words or add spaces. This is a standard R6.5 app.

Thanks!  Maggie
0
Comment
Question by:maggieball
  • 5
  • 4
  • 2
11 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16932496
This is a similar question:
    http:Q_21886739.html "Using TextBold in MailSend":
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16938784
YOu can do a whole lot, maggie.  If you post an example, we'll help you with the script.
0
 

Author Comment

by:maggieball
ID: 16939128
Wonderful.  Judging from sjef's response this is more or less possible with script.  Under the heading of IDEAL is what I'd love to have in the bodyfield.  I've used HTML to do the coding just because it's fairly well known and clear, but any blue would do, and any bullet or even a dash would do for the bulleted bits (and if you'd prefer me to use plain text to HTML, I'm happy to do that).  If not all of this is possible, that's okay.  Whatever formatting is possible will help.  Thanks so much!  Maggie

IDEAL

[start bodyfield]
Please follow the link below to the Report Review Database.<p>

In the <b><font color=#0033FF>Author's Section 1:</font></b><p>

<ul>Open and read the attached report<p>

In the <b><font color=#0033FF>Report Committee Section:</font></b><p>

<ul>Press<b><font color=#0033FF> Edit</font></b><br>
<ul>Select appropriate technical and commercial reviewers<br>
<ul>Press <b><font color=#0033FF>Submit to Reviewers</font></b><p>

[IncludeDocLink]<p>

<small>If you have any difficulties with this doclink, or need to discuss the report before submitting to reviewers, please contact the author.  Thank you.

[END]

EXISTING MAILSEND:

@MailSend(revpanel; ""; ""; ""A new report: " + Title + " by: " + Author + " has been placed on the Report Review database and requires you to select appropriate reviewers."; "Please follow the link below to the Report Review Database. In the Author's Section 1: Open and read the attached report. In the Report Committee Section: Press Edit. Select appropriate technical and commercial reviewers. Press Submit to Reviewers. If you have any difficulties with this doclink, or need to discuss the report before submitting to reviewers, please contact the author.  Thank you."; [IncludeDocLink])
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16939729
Here you go.  This agent will step through a view and send an email for each document.  To test this, provide a view , and set the TEST_FLAG to True, and add your email address to the TEST constants.  For production, use the field names on the document, so for instance, SENDTO_FIELDNAME = "revpanel"

When set to TEST, then the tast bar will count the number of documents, else, it will just post the total in the server log at the end.

Sub Initialize
      'ADJUST THE CONSTANTS!!!!......................................................................
      'Add the FIELD name values here from the doc collection
      Const SENDTO_FIELDNAME = "Enter the SEND TO FieldName"
      Const COPYTO_FIELDNAME="Enter the COPY TO Field Name"
      Const FROM_FIELDNAME ="Enter the FROM FieldName"
      Const SUBJECT_FIELDNAME = "Enter the SUBJECT fieldName"
      Const VIEW_NAME = "WHICH LOOKUP VIEW"
      Const NUM_VIEWICON = 91
      'Set this to FALSE  when you want to use the document fields INSTEAD of the TEST values
      'Basically when TEST_FLAG is set to TRUE then the TEST emails go to the TEST address
      'When TEST_FLAG is set to FALSE,  then the emails will go to the document fields listed above.
      '................................................................
      Const TEST_FLAG = True
      '.................................................................
      Const TEST_SENDTO="Your Test EMail"
      Const TEST_COPYTO=""
      Const TEST_FROM="Your Test EMail"
      Const TEST_SUBJECT="TEST RICH TEXT EMAIL"            
      '-------------------------------------------------------------------------------------------------------      
      Dim Session As New NotesSession
      Dim db As NotesDatabase
      Set db = session.currentdatabase
      Dim doc As NotesDocument
      Dim lookupview As NotesView
      Set lookupview = db.GetView(VIEW_NAME)
      If lookupview Is Nothing Then
            Print "Unable to locate the lookup view..."
            Exit Sub
      End If
      
      Dim bullet As String
      bullet = Chr(149)
      
      On Error Goto Handle_Error
      
      'Rich Text parameters      
      Dim rtItem As NotesRichTextItem
      Dim richStyle As NotesRichTextStyle
      Set richStyle = session.CreateRichTextStyle
      Dim BlueColor As NotesColorObject
      Set BlueColor = session.createColorObject()
      
      'First Style Black helv 11 pt
      With richStyle
            .NotesColor = Color_black
            .NotesFont = Font_helv
            .Bold = False
            .FontSize = 11
      End With
      
      'Blue Style
      Dim richBlue As NotesRichTextStyle
      Set richBlue = session.createRichTextStyle
      With richBlue
            .NotesColor = Color_Blue
            .NotesFont = Font_helv
            .Bold = True
            .FontSize = 11
      End With
      
      Dim rtpStyle As NotesRichTextParagraphStyle
      Set rtpStyle = session.CreateRichTextParagraphStyle
      With rtpStyle
            Dim pos As Integer
            Dim interval As Long            
            pos = RULER_ONE_INCH
            Interval = RULER_ONE_INCH * .50
            .SetTabs  5, POS, INTERVAL, TAB_LEFT
      End With
      Dim processcount As Long
      processcount = 0
      Set doc = lookupview.GetFirstDocument      
      While Not doc Is Nothing            
            Processcount = Processcount +1
            If TEST_FLAG Then
                  Print "Processing " + Cstr( processcount)
            End If
            Dim maildoc As NotesDocument
            Set maildoc = db.CreateDocument
            Set rtItem = New NotesRichTextItem(Maildoc,"Body")
      'This is the mail body portion.....................................................
            With rtitem
                  .AddNewline 1            
                  .appendstyle richstyle      
                  .Appendparagraphstyle rtpStyle
                  .appendtext {Please follow the link below to the Report Review Database}
            'Indent 1.25"......................................................................................                  
                  rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.25
                  rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.25
                  .Appendparagraphstyle rtpStyle
                  .AddNewline 1            
                  .appendText {In the }
                  .appendStyle richBlue
                  .appendText {Author's Section 1:  }
                  .appendstyle richstyle      
            'indent 1.5".......................................................................................                  
                  rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.5
                  rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.5
                  .Appendparagraphstyle rtpStyle
                  .appendText {Open and read the attached report.}
            ''Indent 1.25"......................................................................................                  
                  rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.25
                  rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.25
                  .Appendparagraphstyle rtpStyle
                  .AddnewLine 1
                  .appendText {In the }
                  .appendStyle richBlue
                  .appendText {Report Committee Section:  }
            'indent 1.5".......................................................................................                  
                  rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.5
                  rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.5
                  .Appendparagraphstyle rtpStyle
                  '.addnewLine 1
                  .appendStyle richStyle
                  .appendText bullet + {  Press }
                  .appendStyle richBlue
                  .appendText {Edit }
                  .addnewline 1
                  .appendstyle richStyle
                  .appendText bullet + {  Select appropriate technical and commercial reviewers }
                  .addnewLine 1
                  .appendText bullet + {  Press }
                  .appendStyle richBlue
                  .appendText {Submit to Reviewers }
                  
                  'Outdent to 1"..........................................................................                  
                  rtpStyle.LeftMargin =RULER_ONE_INCH
                  rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH
                  .Appendparagraphstyle rtpStyle
                  RichStyle.FontSize = 9
                  .appendStyle RichStyle                  
                  .addnewline 2
                  .Appenddoclink  doc, "Link to Document"
                  .addtab(1)
                  richStyle.Bold = True
                  richstyle.Italic = True
                  .appendstyle richstyle
                  .appendText {<< Link to the Report Review Database}
                  richStyle.Bold = False
                  richstyle.Italic = False
                  .appendstyle richstyle
                  .addnewline 2            
                  .appendText {If you have any difficulties with this doclink, or need to discuss the report before submitting to reviewers, please contact the author.}
                  .addnewline 2
                  .appendtext   {Thank you.}            
            End With
            With maildoc
                  .form = "Memo"
                  .~_ViewIcon = NUM_VIEWICON
                  If Not TEST_FLAG Then            
                        .SendTo=doc.GetItemValue(SENDTO_FIELDNAME)
                        If COPYTO_FIELDNAME <>"" Then
                              .CopyTo = doc.GetItemValue(COPYTO_FIELDNAME)
                        End If
                        .BlindCopyto = doc.GetItemValue(FROM_FIELDNAME)(0)
                        .principal = doc.GetItemValue(FROM_FIELDNAME)(0)
                        .From = doc.GetItemValue(FROM_FIELDNAME)(0)
                        .Subject = doc.GetItemValue(SUBJECT_FIELDNAME)(0)
                  Else            
                        .sendTo = TEST_SENDTO
                        .Subject = TEST_SUBJECT
                        .principal = TEST_FROM
                        .From = TEST_FROM                  
                  End If
                  .send False
                  Set maildoc = Nothing
            End With
           'Move to the next document
            Set doc = lookupview.getnextdocument(doc)
      Wend
      
      Print "Finished processing " + Cstr(Processcount) + " documents"
      Exit Sub
      
Handle_Error:
      On Error Goto 0
      Print "Error processing the email: "  + Error$ + "-" + Str(Err)
      Exit Sub
      
End Sub
0
 

Author Comment

by:maggieball
ID: 16940121
Wow! That's some Script.  Okay, looks easy enough for me to do.  Just let me clarify what the view needs to contain.     Is it just the revpanel names?  Why do I need a view?  (I don't mind creating a view, but it will just help me to understand at a basic level what the agent is doing).  Don't the number of revpanel names in that field provide the number of documents? Or does the view do something else?  (sorry if that's a dumb question).

Thanks!  Maggie
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:maggieball
ID: 16940138
Sorry, one more dumb question.  Can I put the script within a button?  So that the message is sent (like the previous mailsend was) when the button is pressed?  Presumably I can just do this by using LotusScript as the option and just pasting it 'Click'?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16940819
Can't beat MCSE (Marilyn's Coding Service Enterprises Inc.)
0
 
LVL 18

Accepted Solution

by:
marilyng earned 450 total points
ID: 16941820
Ah  script in the button.  

change this:
 Dim lookupview As NotesView
     Set lookupview = db.GetView(VIEW_NAME)
     If lookupview Is Nothing Then
          Print "Unable to locate the lookup view..."
          Exit Sub
     End If
-------------------

To this:
Dim coll as NotesDocumentCollection
set coll = db.unprocesseddocuments
if coll.count <1 then
   msgbox "You need to select documents",,"Nothing selected"
end if

--------------
Then change the start of the loop to:
 Set doc = coll.GetFirstDocument    
 

at the end of the loop:

set doc= coll.getnextdocument(doc)
wend

------

Now you can put it into a button, I think.. it will work on all selected documents in the view.

--------

The other question.. doesn't matter what's in the view, as long as it's documents you want to process.  The original will step through the view and send an email to every entry in the view.

-----

Caveat.. doesn't work for web or SMTP mail.  You get paragraphs but no color.  Am working on that one. (sjef, this was in response to that other rt question, near as I can tell, color doesn't get sent, because it's NOTESCOLOR instead of RGB - duh. I am trying to see if I can't do passthrough HTML, but that doesn't seem to work internally in an email.   I originally thought to just grab the html and make it passthrough, but all I got was a tagged email.  Shall I open a question for this one?)

----

I used a view because I thought you were sending automated emails,
0
 

Author Comment

by:maggieball
ID: 16946996
I'm being awkward and fussy now, but can I leave out the view altogether?  There's no automation involved (the mail gets sent when button is pressed) and the only critieria for documents is the number of reviewers from the revpanel field, so it should be self-contained (in other words, the view would be duplicating the information from the revpanel field only).  Also, can we leave out the testing elements since I can just put my name in revpanel to test.

Thanks!  I'm just trying to keep the script as simple as possible so I have some hope of managing it down the line.  Maggie
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16947265
You can do whatever you want :)  

Set  Const TEST_FLAG = False to skip the test values.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16947750
Here is button -

sub click()
  'ADJUST THE CONSTANTS!!!!......................................................................
     'Add the FIELD name values here from the doc collection
     Const SENDTO_FIELDNAME = "Enter the SEND TO FieldName"
     Const COPYTO_FIELDNAME="Enter the COPY TO Field Name"
     Const FROM_FIELDNAME ="Enter the FROM FieldName"
     Const SUBJECT_FIELDNAME = "Enter the SUBJECT fieldName"    
     Const NUM_VIEWICON = 91    
    '................................................................
   
     Dim Session As New NotesSession
'Here is the button - you instantiate the workspace and use the current open document
Dim ws as New NotesUIWorkspace
Dim uidoc = ws.currentdocument
     Dim db As NotesDatabase
     Set db = session.currentdatabase
     Dim doc As NotesDocument
     set doc = uidoc.document
 
     Dim bullet As String
     bullet = Chr(149)
     
     On Error Goto Handle_Error
     
      'Rich Text parameters    
     Dim rtItem As NotesRichTextItem
     Dim richStyle As NotesRichTextStyle
     Set richStyle = session.CreateRichTextStyle
     Dim BlueColor As NotesColorObject
     Set BlueColor = session.createColorObject()
     
     'First Style Black helv 11 pt
     With richStyle
          .NotesColor = Color_black
          .NotesFont = Font_helv
          .Bold = False
          .FontSize = 11
     End With
     
     'Blue Style
     Dim richBlue As NotesRichTextStyle
     Set richBlue = session.createRichTextStyle
     With richBlue
          .NotesColor = Color_Blue
          .NotesFont = Font_helv
          .Bold = True
          .FontSize = 11
     End With
     
     Dim rtpStyle As NotesRichTextParagraphStyle
     Set rtpStyle = session.CreateRichTextParagraphStyle
     With rtpStyle
          Dim pos As Integer
          Dim interval As Long          
          pos = RULER_ONE_INCH
          Interval = RULER_ONE_INCH * .50
          .SetTabs  5, POS, INTERVAL, TAB_LEFT
     End With
     Dim processcount As Long
     processcount = 0          
     if not doc Is Nothing          
          Processcount = Processcount +1
          Print "Processing " + Cstr( processcount)
       
          Dim maildoc As NotesDocument
          Set maildoc = db.CreateDocument
          Set rtItem = New NotesRichTextItem(Maildoc,"Body")
     'This is the mail body portion.....................................................
          With rtitem
               .AddNewline 1          
               .appendstyle richstyle    
               .Appendparagraphstyle rtpStyle
               .appendtext {Please follow the link below to the Report Review Database}
          'Indent 1.25"......................................................................................              
               rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.25
               rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.25
               .Appendparagraphstyle rtpStyle
               .AddNewline 1          
               .appendText {In the }
               .appendStyle richBlue
               .appendText {Author's Section 1:  }
               .appendstyle richstyle    
          'indent 1.5".......................................................................................              
               rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.5
               rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.5
               .Appendparagraphstyle rtpStyle
               .appendText {Open and read the attached report.}
          ''Indent 1.25"......................................................................................              
               rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.25
               rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.25
               .Appendparagraphstyle rtpStyle
               .AddnewLine 1
               .appendText {In the }
               .appendStyle richBlue
               .appendText {Report Committee Section:  }
          'indent 1.5".......................................................................................              
               rtpStyle.LeftMargin =RULER_ONE_INCH  * 1.5
               rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH  * 1.5
               .Appendparagraphstyle rtpStyle
               '.addnewLine 1
               .appendStyle richStyle
               .appendText bullet + {  Press }
               .appendStyle richBlue
               .appendText {Edit }
               .addnewline 1
               .appendstyle richStyle
               .appendText bullet + {  Select appropriate technical and commercial reviewers }
               .addnewLine 1
               .appendText bullet + {  Press }
               .appendStyle richBlue
               .appendText {Submit to Reviewers }
               
               'Outdent to 1"..........................................................................              
               rtpStyle.LeftMargin =RULER_ONE_INCH
               rtpStyle.FirstLineLeftMargin =RULER_ONE_INCH
               .Appendparagraphstyle rtpStyle
               RichStyle.FontSize = 9
               .appendStyle RichStyle              
               .addnewline 2
               .Appenddoclink  doc, "Link to Document"
               .addtab(1)
               richStyle.Bold = True
               richstyle.Italic = True
               .appendstyle richstyle
               .appendText {<< Link to the Report Review Database}
               richStyle.Bold = False
               richstyle.Italic = False
               .appendstyle richstyle
               .addnewline 2          
               .appendText {If you have any difficulties with this doclink, or need to discuss the report before submitting to reviewers, please contact the author.}
               .addnewline 2
               .appendtext   {Thank you.}          
          End With
          With maildoc
               .form = "Memo"
               .~_ViewIcon = NUM_VIEWICON
               .SendTo=doc.GetItemValue(SENDTO_FIELDNAME)
               If COPYTO_FIELDNAME <>"" Then
                   .CopyTo = doc.GetItemValue(COPYTO_FIELDNAME)
               End If
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
               'You can set these values to: blindcopyto = session.username  and not use a field on the document for the "from" value.
                .BlindCopyto = doc.GetItemValue(FROM_FIELDNAME)(0)
                .principal = doc.GetItemValue(FROM_FIELDNAME)(0)
                .From = doc.GetItemValue(FROM_FIELDNAME)(0)
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                .Subject = doc.GetItemValue(SUBJECT_FIELDNAME)(0)            
               .send False
               Set maildoc = Nothing
          End With
         
     end if
     
     msgbox "Finished processing " + Cstr(Processcount) + " documents"
     Exit Sub
     
Handle_Error:
     On Error Goto 0
     msgbox "Error processing the email: "  + Error$ + "-" + Str(Err)
     Exit Sub
     
End Sub
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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…

760 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

19 Experts available now in Live!

Get 1:1 Help Now