Adding CC to Newsletter

Posted on 2008-10-20
Last Modified: 2013-12-18
What would be the code to add a CC and/or a BCC to the newsletter code below.
Sub Click(Source As Button)

	Dim s As New NotesSession

	Dim w As New NotesUIWorkspace

	Dim db As NotesDatabase

	Dim v As NotesView

	Dim c As NotesDocumentCollection

	Dim doc As NotesDocument

	Dim key As String

	Dim cur As NotesDocument

	Set db = s.CurrentDatabase

	Set doc = w.CurrentDocument.Document

	key = doc.ussales(0)    'get the name of office (view category) from the current document

	Set v = db.GetView( "newsletter" ) 'maybe you'll have to create the view that is categorized by office

	Set c = v.GetAllDocumentsByKey( key, True )

	Dim newDoc As New NotesDocument( db )

	Dim rt As NotesRichTextItem

	Set rt = newDoc.CreateRichTextItem( "Body" )

	Dim rtsHeader As NotesRichTextStyle, rtsNormal As NotesRichTextStyle

	Set rtsHeader = s.CreateRichTextStyle  

	Set rtsNormal = s.CreateRichTextStyle


	rtsHeader.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables

	rtsHeader.FontSize = 12

	rtsHeader.Bold = True


	rtsNormal.NotesFont = FONT_COURIER

	rtsNormal.FontSize = 10

	rtsNormal.Bold = False


	Call rt.AppendStyle( rtsHeader )


	Call rt.AddNewLine( 3 )

	Call rt.AppendText( "Employee #" )

	Call rt.AddTab( 1 )

	Call rt.AppendText( "Current Asset" )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New Asset " )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New  Mon Asset" )

	Call rt.AddNewLine( 1 )


	Call rt.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header


	Set cur = c.GetFirstDocument

	Do Until cur Is Nothing

		Call rt.AddNewLine( 1 )

		Call rt.AppendText( cur.emp_num(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendText( cur.current_asset(0) )

		Call rt.AddTab( 3 )

		Call rt.AppendText( cur.new_asset(0) )

		Call rt.AddTab( 3 )

		Call rt.AppendText( cur.new_mon_asset(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendDocLink( cur, "Link to document " )  'add link to doc to the end


		Set cur = c.GetNextDocument( cur )


	newDoc.Form = "Memo"

	newDoc.Subject = "IBPC Refresh DLM Update SBS"' + cur.office_num_adjusted

	Call newDoc.Save( True, True )

	Call newDoc.Send( True, "Field Technology" )

Open in new window

Question by:jforget1
  • 5
  • 3
  • 2
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757642
Call newdoc.ReplaceItemValue("SendTo", array_of_recievers)
Call newdoc.ReplaceItemValue("CopyTo", array_of_CC_recievers)
Call newdoc.ReplaceItemValue("BlindCopyTo", array_of_BCC_recievers)

Call newdoc.Send(False)

Why Send(True)?? Not good, IMHO.
LVL 22

Accepted Solution

mbonaci earned 500 total points
ID: 22757655
newDoc.CopyTo = "CC Address"
newDoc.BlindCopyTo = "BCC Address"

In case of any problems try this:

newDoc.EnterCopyTo = "CC Address"
newDoc.EnterBlindCopyTo = "BCC Address"

LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757661
receiver of course... :$
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757973
Why did you accept the second (best) answer?

Author Comment

ID: 22760047
Because it was the least complicated and it worked on the first try. Arrays scare me a little. :>)

Any idea on how I can get the code right to update the value of 2 fields on the record the user is on.

      Call doc.FieldSetText("status", "Reclamation Approved")
      Call doc.FieldSetText("reclamation_approved_flag", "done")
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

LVL 46

Expert Comment

by:Sjef Bosman
ID: 22760395
Yep, but not in this question. Piggy-backers scare me off a little... ;-)

Author Comment

ID: 22760451
I will be happy to post a new ?
LVL 22

Expert Comment

ID: 22760509

FieldSetText is used when the user has document opened in edit mode and is the method of NotesUIDocument, not NotesDocument.

You can replace FieldSetText with ReplaceItemValue, like this:

      Call doc.ReplaceItemValue(FieldName, NewValue)

or in your case:

      Call doc.ReplaceItemValue("status", "Reclamation Approved")
      Call doc.ReplaceItemValue("reclamation_approved_flag", "done")

Thanks for the points,
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22760602

Author Comment

ID: 22760920
Thanks Mb.

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

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 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