Solved

Adding CC to Newsletter

Posted on 2008-10-20
10
264 Views
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 )
	Loop
	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

0
Comment
Question by:jforget1
[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
  • 5
  • 3
  • 2
10 Comments
 
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.
0
 
LVL 22

Accepted Solution

by:
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"


Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22757661
receiver of course... :$
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

Expert Comment

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

Author Comment

by:jforget1
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")
0
 
LVL 46

Expert Comment

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

Author Comment

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

Expert Comment

by:mbonaci
ID: 22760509
Jforget,

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,
Mb¤
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22760602
LOL
0
 

Author Comment

by:jforget1
ID: 22760920
Thanks Mb.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

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
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.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

751 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