Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext


Manmeet S Ahluwalia 6.Mar.12 06:54 AM a Web browser
Applications Development 7.0.2 Windows XP


Sub Click(Source As Button)
%REM
This code is used for sending mails
%END REM
On Error Goto e
Dim maildb As notesdatabase
Dim ndc As NotesDocumentCollection
Dim doc As notesdocument, MailDoc As notesdocument, tempdoc As NotesDocument
Dim rtitem As NotesRichTextItem ' Richtextitem Item
Dim rttable As NotesRichTextTable ' For getting the handle of the table in the Richtextitem item
Dim rtStyle As NotesRichTextStyle ' For adding formatting rules to the table i.e. font , color etc.
Dim rtpstyles(1 To 4) As NotesRichTextParagraphStyle ' For adding margins , alignment etc.
Dim TopColObj As NotesColorObject , AltColObj As NotesColorObject 'Color objects defined for row coloring
Dim prefix As String, PersonalSig As String, FileContentType As String
Dim uidoc As notesuidocument, uimaildoc As NotesUIDocument
Dim profiledoc As notesdocument, mailProfile As NotesDocument
Dim ws As New notesuiworkspace
Dim mime As NotesMimeEntity
Dim stream As NotesStream
Dim item As NotesRichTextItem

Set uidoc=ws.currentdocument
Set doc=uidoc.document

Dim db As notesdatabase
Dim session As New notessession

Set db=session.currentdatabase
Set profiledoc=db.getprofiledocument("profile")
Set maildb = New NotesDatabase( "", "" )

maildb.OpenMail
Set MailDoc = maildb.CreateDocument
MailDoc.Form = "Memo"
prefix$ = profiledoc.EmailSubjectPrefix(0)
If Len(prefix$) > 0 Then
prefix$ = prefix$ & " "
End If

MailDoc.Subject = "Test Subject"
Set rtitem = New NotesRichTextItem( MailDoc , "Body" )
' For setting the Margins and Alignments of the 4 columns
Call rtitem.AppendDocLink( doc, "Link")
rtitem.Update
Set mailProfile = MailDb.GetProfileDocument("CalendarProfile")
PersonalSig = mailProfile.Signature( 0 )
If mailProfile.SignatureOption( 0 ) = "1" Then
rtitem.AddNewline( 2 )
Call rtitem.AppendText( PersonalSig )
rtitem.Update
maildoc.Save True, False
Else
Set mime = maildoc.CreateMIMEEntity( "PersonalSignature" )
Set stream = session.CreateStream
Call stream.Open( PersonalSig )
FileContentType = GetContentTypeFromFile( PersonalSig )
Call mime.SetContentFromBytes(stream, _
FileContentType , ENC_IDENTITY_BINARY)
Call stream.Close
maildoc.Save True, False
Set item = maildoc.GetFirstItem( "PersonalSignature" )
rtitem.AddNewline( 2 )
Call rtitem.AppendRTItem( item )
rtitem.Update
End If
Set uimaildoc = ws.EditDocument( True, maildoc, False, , False, True )
Exit Sub
e:
Msgbox Error & Erl
End Sub

************** GetContentTypeFromFile ****************
Function GetContentTypeFromFile( FileName As String )As String
Dim ContentType As String, FileExt As String

FileExt = Strrightback( FileName, "." )
Select Case FileExt
Case "txt" : ContentType = "plain/text"
Case "gif" : ContentType = "image/gif"
Case "jpg" : ContentType = "image/jpeg"
Case "bmp" : ContentType = "image/bmp"
Case "html" : ContentType = "text/html;charset=UTF-8"
End Select
GetContentTypeFromFile = ContentType
End Function








  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite