How to store raw mime message to notes database

xiaoxiao2021-03-06  85

Transfer ldd (http://www-10.lotus.com/ldd/46dom.nsf/c21908baf7e06eb085256a39006eae9f/8a656aebb3d4932a80256b90003bba52?OpenDocument) Note:! Do not use this sample code in e-mail applications Notes and Domino can send HTML e-mail Automatically from Notes Rich TEXT. You do not need to write...........!!!!!!!!!!!!!!

This Is Implement in NotesmimeTies Class in LotusScript To Create Mime Part Items. For Example, Here Is Code In A Button That Sends AN HTML E-MAIL.

Sub Click (Source As Button)

Sendto $ = "myself@someisp.com"

Subject $ = "Notes 6 MIME"

HTMLText $ = { this is an html message. }

DIM session as new notessession

DIM HTML AS NotesStream

Set html = session.createstream

HTML.WRITEXT HTMLTEXT $

DIM DOC AS New NotesDocument (session.currentDatabase)

DIM MIME AS NotesmimeTity

SET MIME = Doc.createmimeTity ("Body")

Mime.setContentFromText HTML, "Text / HTML", Enc_none

Doc.subject = SUBJECT $

Doc.send False, Sendto $

End Sub

In R5 The NotesmimeTies Class Is Read-Only. You Can Use It To Read An Existing Mime Part Item, But Not To Create A New Mime Part Item. So, In R5, You Have To Use Api Calls to Do The Same Thing:

Const wapimodule = "nnotes" 'Windows / 32

Const type_mime_part = 25

Type MimePart

Version as integer

Flags0 as in

Flags1 as in

TYPE AS INTEGER

Size as integer

Boundarylength as integer

HeadersLength As INTEGER

Spare0 as integer

Spare1 as long

TEXT (1023) AS Long

End Type

Declare Private Function NSFDBopen Lib Wapimodule Alias ​​"nsfdbopen" _ (ByVal P AS String, HDB As Long) AS Integer

Declare private function nsfdbclose lib wapimodule alias "nsfdbclose" _

(Byval HDB As Long) AS INTEGER

Declare Private Function NSFNOTeopen Lib Wapimodule Alias ​​"NSFNOTeopen" _

(Byval Noteid As Long, ByVal F AS Integer, HNT As Long AS Integer

Declare Private Function NSFNOTECLOSE LIB WAPIModule Alias ​​"NSFNOTECLOSE" _

(Byval Hnt As long) AS Integer

Declare private function nsfnoteupdate lib wapimodule alias "nsfnoteupdate" _

(Byval f AS integer) AS Integer

Declare private function nsfitemappend lib wapimodule alias "nsfitemappend" _

(Byval f AS INTEGER, BYVAL N As String, Byval nn as integer _

, Byval t as integer, v as any, byval nv as long

Declare Private Function OspathnetConstruct Lib Wapimodule Alias ​​"OspathnetConstruct "_

(Byvalz as stay, byval s string, byval n as string) AS integer

Declare private sub pokersstring lib "msvcrt" alias "memcpy" _

(D as long, byval s as string, byval n as long)

Sub Click (Source As Button)

Sendto $ = "myself@someisp.com"

Subject $ = "Notes R5 MIME"

HTMLText $ = { this is an html message. }

CRLF $ = CHR $ (13) & chr $ (10)

Header $ = "Content-Type: TEXT / HTML" & CRLF $ & CRLF $

BodyItem $ = "body"

DIM session as new notessession

DIM DB AS NotesDatabaseDoase

Set db = session.currentDatabase

DIM DOC AS New NotesDocument (session.currentDatabase) doc.subject = Subject $

Doc.save True, False

ID $ = doc.noteid

Delete Doc

Np $ = space (1024)

OspathnetConstruct 0, DB. Server, DB.FilePath, NP $

DIM HDB As Long

NSFDBopen NP $, HDB

DIM HNT As Long

NSFNOPEN HDB, ClNG ("& H" & ID $), 0, HNT

DIM body as mimepart

Body.Version = 2

Body.Flags0 = 2 'HAS Headers

Body.Type = 2 'body

Body.size = len (Header $) LEN (HTMLText $)

Body.headerslength = le (Header $)

Pokelsstring body.text (0), Header $ & HTMLText $, ClNG (Body.Size)

NSFITEMAPPEND HNT, 0, BODYITEM $, LEN (BodyItem $), TYPE_MIME_PART, BODY.VERSION, CLNG (Body.Size 20)

NSFNOTEUPDATE HNT, 0

NSFNOTECLOSE HNT

NSFDBClose HDB

Set doc = db.getdocumentbyid (ID $)

Doc.send False, Sendto $

Doc.remove True

End Sub

转载请注明原文地址:https://www.9cbs.com/read-107914.html

New Post(0)