[quote]อันนี้เป็นตัวอย่างอันวิธีหนึ่งที่ใช้ NotesStream Class ครับ แต่วิธีแรกที่ผมแนะนำ
ไปโดยวิธี NotesRichtext Class ผ่านทาง PassthroughHTML กับ Richtext Style ก็ใช้
ได้เหมือนกันครับ เดียวจะมา post ต่อให้ครับ
Sub MimeMailer(SendTo As String, Subject As String, url As String,hreftext As
String,requestor As String)
'Declare Variables
Dim s As New NotesSession
Dim db As NotesDatabase
Dim body As NotesMIMEEntity
Dim stream As NotesStream
Dim mailReplyTo As NotesName
Dim host As String
Dim tmpURL As String
Dim tmpHost As NotesName
Set db = s.CurrentDatabase
Set tmpHost = New NotesName(s.CommonUserName )
Set mailReplyTo = New NotesName(requestor)
'Determine where Script is running & Setup URL Accordingly.
'Capture the server name and filepath for use in URLs
Dim ServerName As New NotesName( s.CommonUserName )
host = "http://" + ServerName.Common & ".jbhunt.com"
tmpURL = |Click Here| + hreftext + |
|
'End Server & URL Setup.
s.ConvertMIME = False ' Do not convert MIME to rich text
Set stream = s.CreateStream
'Begin creating the message doc to send
Dim message As New NotesDocument (db)
message.Form="memo"
Set body = message.CreateMIMEEntity
'Basic profile of email
message.Subject = Subject
message.SendTo = SendTo
message.RecNoOutOfOffice = "1" 'Set it so out of office agents don't reply to
the message
' Open the HTML (Title doesn't matter since it doesn't appear anywhere)
Call stream.WriteText ("Sample HTML email via MIME")
' BEGIN: Inline Stylesheet
Call stream.WriteText (|
|)
' END: Inline Stylesheet
Call stream.WriteText ({})
Call stream.WriteText ({})
' BEGIN: HTML body
'Call stream.WriteText ({
'
'
' Here is the MIME content!
' Notes:
'
' - MIME emails require absolute URLs on all images and hrefs
'
- HTML can easily be copied directly from an editor to the LotusScript -})
'Call stream.WriteText ("use pipes (|) and curly brackets ({}) to get around
the quote issue.")
'Call stream.WriteText ({
- Stylesheets must be inline vs. linked. (iNotes
will override the stylesheet)})
'Call stream.WriteText ({
- Notes will NOT render table background images, but
colors WILL properly display
'
- Notes will not properly render table rows with a height smaller than the
default text.
'
' Visit SearchDomino.com for
more exciting tips or visit })
Call stream.WriteText(tmpURL)
'Imation for the coolest data storage
products around!
'Call stream.WriteText({ | })
' END: HTML body
' Close the HTML
Call stream.WriteText ({})
' Ensure the MIME content will be recognized as HTML (Must be after the stream
is written)
Call body.SetContentFromText (stream, "text/html;charset=iso-8859-1", ENC_NONE)
'Dim rtitem As NotesRichTextItem
'Set rtitem = New NotesRichTextItem( message, "Body" )
'Call rtitem.AddNewline(2)
'Call rtItem.AppendText("Click on the Document Link to go to the request.")
'Call rtitem.AppendDocLink(doc, "Link to Notes Promotion Checklist")
'Send the email
Call message.Send (False)
s.ConvertMIME = True ' Restore conversion
End Sub
ไฟล์ตัวอย่างครับ
MIMEM
AILER.TXT
:yellow_cool.gif: [/quote]
แบบนี้ได้ครับ
แต่พอลองเอาโค๊ด HTML จริงไปใส่ มัน error ว่า MimeMailer: 342: Token is too long
แสดงว่ามันจำกัดความยาวของ HTML หรือครับ |