我只需要指出了正確的方向,如何 發送使用VBA郵件的Lotus iNotes從接入發送電子郵件。我將Lotus作爲嵌入到Intranet系統中的電子郵件系統。通過安裝在內部網絡
作爲一種嘗試,這種代碼編寫的電子郵件,並通過蓮花發送(安裝在PC):
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim sender, recipient As String
'sender = Forms![LogIn]![TxtEmail]
If (Not IsNull(DLookup("Email", "Users", "UserName ='" & Me.Affectation.Value & "'"))) Then
recipient = DLookup("Email", "Users", "UserName ='" & Me.Affectation.Value & "'")
MsgBox "recipient *" & recipient & "*"
Else
MsgBox " recipient null"
End If
If Not (ns Is Nothing) Then
Call ns.InitializeUsingNotesUserName("CN=MyuserName/O=Cmpany", "password")
Set db = ns.GetDatabase("ServerName", "mail\MyuserName.nsf", False)
If (Not (db Is Nothing)) Then
Set doc = db.CreateDocument()
doc.Form = "Memo"
doc.SendTo = recipient
doc.subject = "Email Subject"
Dim rt As NotesRichTextItem
Set rt = doc.CreateRichTextItem("Body")
rt.AppendText ("Body text")
doc.Send (False)
Set rt = Nothing
Set doc = Nothing
MsgBox "Message Sent."
Else
MsgBox "db Is Nothing"
End If
Set db = Nothing
Set ns = Nothing
Else
MsgBox "ns Is Nothing"
End If
我在這裏的問題是,如何設置此代碼,以使目標蓮花一個在我們的內部網:我的登錄是這樣的「[email protected]」和應用程序被訪問「http://mail.mycompany.com/mail/username.nsf ......」
我不確定我們是否理解了某些東西。您的PC上安裝了Lotus Notes,它可以使用上述代碼發送郵件。您還可以通過Intranet訪問iNotes。但是,PC上安裝的Notes客戶端可能使用的是與Intranet上的iNotes電源相同的服務器。事實上,這是非常普遍的情況。你知道你的情況是否屬實,或者你知道他們是不同的服務器嗎?如果他們是同一臺服務器,爲什麼你需要改變任何東西? –
@RichardSchwartz感謝您的回覆。事實上,是的,我在電腦上安裝了一個Notes客戶端,但我沒有使用它,甚至沒有配置,只需要iNotes,我的意思是設置上面的代碼連接到我的Intranet上的帳戶併發送電子郵件。當我執行代碼時,它會打開本地安裝的客戶端。 – Oumaya