Domino版本:8.0.1
操作系统:windows xp
在CS下判断附件的格式和大小,如果合格,将附件和文本域中的内容集成到邮件文档中并发送。
代码:
Code
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim doc As NotesDocument
Set doc= uidoc.Document
Dim rtitem As Variant
Dim s As New NotesSession
Dim db As NotesDatabase
Set db=s.CurrentDatabase
Dim sizeInBytes As Long
sizeInBytes=0
Dim lei As String
Dim leis As String
Call uidoc.Save
Set rtitem = doc.GetFirstItem( "RTF" )
If doc.HasItem("$file") Then
If ( rtitem.Type = RICHTEXT ) Then
Forall object In rtitem.EmbeddedObjects
sizeInBytes = object.FileSize+sizeInBytes
lei=object.Name
lei=Strright(lei,".")
If lei<>"jpg" And lei<>"doc" And lei<>"xls" Then
Msgbox "您上传的附件格式不对"
Exit Sub
End If
End Forall
If sizeInBytes> 1000000 Then
Msgbox "您上传的附件总大小太大!"
Call uidoc.GotoField("RTF")
Exit Sub
End If
End If
End If
If doc.FaxNumber(0)="" Then
Msgbox "传真号码不能为空!"
Exit Sub
End If
If doc.MailBody(0)="" Then
Msgbox "正文信息不能为空!"
Exit Sub
End If
Dim maildoc As NotesDocument
Set maildoc=New NotesDocument(db)
maildoc.form="Memo"
maildoc.Subject=doc.FaxNumber(0)
maildoc.Sendto="lansr@163.com"
Dim itema As Variant
Dim itemc As Variant
Set itema =maildoc.GetFirstItem("Body")
If itema Is Nothing Then
Set itema=New NotesRichTextItem(maildoc,"Body")
End If
Dim itemb As Variant
Set itemb=doc.GetFirstItem("RTF")
Set itemc=doc.GetFirstItem("MailBody")
Call itema.AppendText(doc.MailBody(0))
Call itema.AddNewLine(1)
Call itema.AppendRTItem(itemb)
Call maildoc.Send(True,True)
doc.tFaxStatus="2"
Call doc.Save(True,True)
Call uidoc.Close()
End Sub
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
Dim doc As NotesDocument
Set doc= uidoc.Document
Dim rtitem As Variant
Dim s As New NotesSession
Dim db As NotesDatabase
Set db=s.CurrentDatabase
Dim sizeInBytes As Long
sizeInBytes=0
Dim lei As String
Dim leis As String
Call uidoc.Save
Set rtitem = doc.GetFirstItem( "RTF" )
If doc.HasItem("$file") Then
If ( rtitem.Type = RICHTEXT ) Then
Forall object In rtitem.EmbeddedObjects
sizeInBytes = object.FileSize+sizeInBytes
lei=object.Name
lei=Strright(lei,".")
If lei<>"jpg" And lei<>"doc" And lei<>"xls" Then
Msgbox "您上传的附件格式不对"
Exit Sub
End If
End Forall
If sizeInBytes> 1000000 Then
Msgbox "您上传的附件总大小太大!"
Call uidoc.GotoField("RTF")
Exit Sub
End If
End If
End If
If doc.FaxNumber(0)="" Then
Msgbox "传真号码不能为空!"
Exit Sub
End If
If doc.MailBody(0)="" Then
Msgbox "正文信息不能为空!"
Exit Sub
End If
Dim maildoc As NotesDocument
Set maildoc=New NotesDocument(db)
maildoc.form="Memo"
maildoc.Subject=doc.FaxNumber(0)
maildoc.Sendto="lansr@163.com"
Dim itema As Variant
Dim itemc As Variant
Set itema =maildoc.GetFirstItem("Body")
If itema Is Nothing Then
Set itema=New NotesRichTextItem(maildoc,"Body")
End If
Dim itemb As Variant
Set itemb=doc.GetFirstItem("RTF")
Set itemc=doc.GetFirstItem("MailBody")
Call itema.AppendText(doc.MailBody(0))
Call itema.AddNewLine(1)
Call itema.AppendRTItem(itemb)
Call maildoc.Send(True,True)
doc.tFaxStatus="2"
Call doc.Save(True,True)
Call uidoc.Close()
End Sub