altri modo per inviare e-mail HTML da LS

TIPS DEVELOPERS antoher invio mail lotusscript html api programmazione

  • 0 commenti
1 -  Metodo

Classe in allegato presa sempre dall'OpenNtf che permette di inviare una mail formato HTML sfruttando le API di Notes...
L'esempio qui sotto ne spiega l'utilizzo messo in un Agente ne spiega l'utilizzo
********************************
Option Public
Use "SimpleMIME"

Sub Initialize

Dim s As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim html As String

Set db = s.currentdatabase
Set doc = db.createdocument

doc.form = "Memo"
doc.sendto = "Davy Vanherbergen"

html = |This is an example

|
html = html + |Hello

|

Call addMimeItem( doc, "Body", html )
Call doc.send(False)

End Sub
********************************

2 -  Metodo


Function CreateAndSend (s As NotesSession,msg_text As String,msg_html As String,Recipient As String,Originator As String, Subject As String)

Dim body As NotesMIMEEntity
Dim header As Variant
Dim child3 As NotesMIMEEntity
Dim child2 As NotesMIMEEntity
Dim child1 As NotesMIMEEntity
Dim stream As NotesStream
Dim stream1 As NotesStream

'## feed this function with
'## NotesSession
'## text for the text alternative to the HTML
'## the HTML as text
'## The email address of the recipient
'## the email address of who you want it to be "from"
'## the subject line as text
'## Create the email document
Set m_doc = db.CreateDocument()
s.ConvertMIME = False '## Do not convert MIME to rich text
Set stream = s.CreateStream
Set body = m_doc.CreateMIMEEntity
Set header = body.CreateHeader("Content-Type")
Call header.SetHeaderVal("multipart/alternative")
Set header = body.CreateHeader("Subject")
Call header.SetHeaderVal(Subject)
Set header = body.CreateHeader("To")
Call header.SetHeaderVal(Recipient)
Set child2 = body.CreateChildEntity
Call stream.WriteText(msg_text)
Call child2.SetContentFromText(stream,"text/plain;charset=iso-8859-1",ENC_NONE)
Call stream.Close
Set child3 = body.createchildEntity
Call stream.WriteText(msg_html)
Call child3.SetContentFromText(stream,"text/html;charset=iso-8859-1",ENC_NONE)
Call stream.Close
m_doc.Principal = Originator '## the spoofing
Call m_doc.Save(True, True)
s.ConvertMIME = True '## Restore conversion
sending:
m_doc.Send False
Sleep(1) '## to reduce the load on the server, it sleeps for one second between sendings

Exit Function

0 Commenti:

    Nessun Commento Trovato
Commenta articolo
 

Questo spazio web è stato creato da per un uso pubblico e gratuito. Qualsiasi tipo di collaborazione sarà ben accetta.
Per maggiori informazioni, scrivete a info@dominopoint.it

About Dominopoint
Social
Dominopoint social presence: