您的位置:首页 > 服装鞋帽 > 女装 > How to send Lotus Notes mail messages ...

How to send Lotus Notes mail messages ...

luyued 发布于 2011-03-26 19:18   浏览 N 次  

  Question

  Customers with Microsoft Visual Basic (VB) or VB.NET applications might want to integrate Lotus Notes e-mail functionality. Is there an example of how to create a Notes e-mail from Visual Basic?

  Answer

  The following Microsoft Visual Basic 6 (VB6) code sends a Notes e-mail message. It includes examples of code to include an attachment and to save the sent message, which are both optional and can be removed if desired.

  IMPORTANT NOTE: This is sample code, provided only to illustrate one way to approach this issue. IBM Support will not be able to customize this script for a customer's own configuration. While this may work for some customers it is offered as a suggestion only, and is not something that IBM Lotus software supports further. Dim Maildb As Object

  Dim MailDoc As Object

  Dim Body As Object

  Dim Session As Object

  'Start a session to notes

  Set Session = CreateObject("Lotus.NotesSession")

  'This line prompts for password of current ID noted in Notes.INI

  Call Session.Initialize

  'or use below to supply password of the current ID

  'Call Session.Initialize("")

  'Open the mail database in notes

  Set Maildb = Session.GETDATABASE("", "c:\notes\data\mail\mymail.nsf")

  If Not Maildb.IsOpen = True Then

  Call Maildb.Open

  End If

  'Create the mail document

  Set MailDoc = Maildb.CREATEDOCUMENT

  Call MailDoc.ReplaceItemValue("Form", "Memo")

  'Set the recipient

  Call MailDoc.ReplaceItemValue("SendTo", "John Doe")

  'Set subject

  Call MailDoc.ReplaceItemValue("Subject", "Subject Text")

  'Create and set the Body content

  Set Body = MailDoc.CREATERICHTEXTITEM("Body")

  Call Body.APPENDTEXT("Body text here")

  'Example to create an attachment (optional)

  Call Body.ADDNEWLINE(2)

  Call Body.EMBEDOBJECT(1454, "", "C:\filename", "Attachment")

  'Example to save the message (optional)

  MailDoc.SAVEMESSAGEONSEND = True

  'Send the document

  'Gets the mail to appear in the Sent items folder

  Call MailDoc.ReplaceItemValue("PostedDate", Now())

  Call MailDoc.SEND(False)

  'Clean Up

  Set Maildb = Nothing

  Set MailDoc = Nothing

  Set Body = Nothing

  Set Session = Nothing

  Note: The Visual Basic programmer needs to set the Reference to use Lotus Domino objects prior to implementing this function. To enable the Lotus Notes classes to appear in the Visual Basic browser, you must execute the following within VB: Select Tools, References and select the checkbox for 'Lotus Notes Automation Classes'.

  Cross Reference information

  Question

  Customers with Microsoft Visual Basic (VB) or VB.NET applications might want to integrate Lotus Notes e-mail functionality. Is there an example of how to create a Notes e-mail from Visual Basic?

  Answer

  The following Microsoft Visual Basic 6 (VB6) code sends a Notes e-mail message. It includes examples of code to include an attachment and to save the sent message, which are both optional and can be removed if desired.

  IMPORTANT NOTE: This is sample code, provided only to illustrate one way to approach this issue. IBM Support will not be able to customize this script for a customer's own configuration. While this may work for some customers it is offered as a suggestion only, and is not something that IBM Lotus software supports further. Dim Maildb As Object

  Dim MailDoc As Object

  Dim Body As Object

  Dim Session As Object

  'Start a session to notes

  Set Session = CreateObject("Lotus.NotesSession")

  'This line prompts for password of current ID noted in Notes.INI

  Call Session.Initialize

  'or use below to supply password of the current ID

  'Call Session.Initialize("")

  'Open the mail database in notes

  Set Maildb = Session.GETDATABASE("", "c:\notes\data\mail\mymail.nsf")

  If Not Maildb.IsOpen = True Then

  Call Maildb.Open

  End If

  'Create the mail document

  Set MailDoc = Maildb.CREATEDOCUMENT

  Call MailDoc.ReplaceItemValue("Form", "Memo")

  'Set the recipient

  Call MailDoc.ReplaceItemValue("SendTo", "John Doe")

  'Set subject

  Call MailDoc.ReplaceItemValue("Subject", "Subject Text")

  'Create and set the Body content

  Set Body = MailDoc.CREATERICHTEXTITEM("Body")

  Call Body.APPENDTEXT("Body text here")

  'Example to create an attachment (optional)

  Call Body.ADDNEWLINE(2)

  Call Body.EMBEDOBJECT(1454, "", "C:\filename", "Attachment")

  'Example to save the message (optional)

  MailDoc.SAVEMESSAGEONSEND = True

  'Send the document

  'Gets the mail to appear in the Sent items folder

  Call MailDoc.ReplaceItemValue("PostedDate", Now())

  Call MailDoc.SEND(False)

  'Clean Up

  Set Maildb = Nothing

  Set MailDoc = Nothing

  Set Body = Nothing

  Set Session = Nothing

  Note: The Visual Basic programmer needs to set the Reference to use Lotus Domino objects prior to implementing this function. To enable the Lotus Notes classes to appear in the Visual Basic browser, you must execute the following within VB: Select Tools, References and select the checkbox for 'Lotus Notes Automation Classes'.

  Cross Reference information

  Question

  Customers with Microsoft Visual Basic (VB) or VB.NET applications might want to integrate Lotus Notes e-mail functionality. Is there an example of how to create a Notes e-mail from Visual Basic?

  Answer

  The following Microsoft Visual Basic 6 (VB6) code sends a Notes e-mail message. It includes examples of code to include an attachment and to save the sent message, which are both optional and can be removed if desired.

  IMPORTANT NOTE: This is sample code, provided only to illustrate one way to approach this issue. IBM Support will not be able to customize this script for a customer's own configuration. While this may work for some customers it is offered as a suggestion only, and is not something that IBM Lotus software supports further. Dim Maildb As Object

  Dim MailDoc As Object

  Dim Body As Object

  Dim Session As Object

  'Start a session to notes

  Set Session = CreateObject("Lotus.NotesSession")

  'This line prompts for password of current ID noted in Notes.INI

  Call Session.Initialize

  'or use below to supply password of the current ID

  'Call Session.Initialize("")

  'Open the mail database in notes

  Set Maildb = Session.GETDATABASE("", "c:\notes\data\mail\mymail.nsf")

  If Not Maildb.IsOpen = True Then

  Call Maildb.Open

  End If

  'Create the mail document

  Set MailDoc = Maildb.CREATEDOCUMENT

  Call MailDoc.ReplaceItemValue("Form", "Memo")

  'Set the recipient

  Call MailDoc.ReplaceItemValue("SendTo", "John Doe")

  'Set subject

  Call MailDoc.ReplaceItemValue("Subject", "Subject Text")

  'Create and set the Body content

  Set Body = MailDoc.CREATERICHTEXTITEM("Body")

  Call Body.APPENDTEXT("Body text here")

  'Example to create an attachment (optional)

  Call Body.ADDNEWLINE(2)

  Call Body.EMBEDOBJECT(1454, "", "C:\filename", "Attachment")

  'Example to save the message (optional)

  MailDoc.SAVEMESSAGEONSEND = True

  'Send the document

  'Gets the mail to appear in the Sent items folder

  Call MailDoc.ReplaceItemValue("PostedDate", Now())

  Call MailDoc.SEND(False)

  'Clean Up

  Set Maildb = Nothing

  Set MailDoc = Nothing

  Set Body = Nothing

  Set Session = Nothing

  Note: The Visual Basic programmer needs to set the Reference to use Lotus Domino objects prior to implementing this function. To enable the Lotus Notes classes to appear in the Visual Basic browser, you must execute the following within VB: Select Tools, References and select the checkbox for 'Lotus Notes Automation Classes'.

  Cross Reference information

  Question

  Customers with Microsoft Visual Basic (VB) or VB.NET applications might want to integrate Lotus Notes e-mail functionality. Is there an example of how to create a Notes e-mail from Visual Basic?

  Answer

  The following Microsoft Visual Basic 6 (VB6) code sends a Notes e-mail message. It includes examples of code to include an attachment and to save the sent message, which are both optional and can be removed if desired.

  IMPORTANT NOTE: This is sample code, provided only to illustrate one way to approach this issue. IBM Support will not be able to customize this script for a customer's own configuration. While this may work for some customers it is offered as a suggestion only, and is not something that IBM Lotus software supports further. Dim Maildb As Object

  Dim MailDoc As Object

  Dim Body As Object

  Dim Session As Object

  'Start a session to notes

  Set Session = CreateObject("Lotus.NotesSession")

  'This line prompts for password of current ID noted in Notes.INI

  Call Session.Initialize

  'or use below to supply password of the current ID

  'Call Session.Initialize("")

  'Open the mail database in notes

  Set Maildb = Session.GETDATABASE("", "c:\notes\data\mail\mymail.nsf")

  If Not Maildb.IsOpen = True Then

  Call Maildb.Open

  End If

  'Create the mail document

  Set MailDoc = Maildb.CREATEDOCUMENT

  Call MailDoc.ReplaceItemValue("Form", "Memo")

  'Set the recipient

  Call MailDoc.ReplaceItemValue("SendTo", "John Doe")

  'Set subject

  Call MailDoc.ReplaceItemValue("Subject", "Subject Text")

  'Create and set the Body content

  Set Body = MailDoc.CREATERICHTEXTITEM("Body")

  Call Body.APPENDTEXT("Body text here")

  'Example to create an attachment (optional)

  Call Body.ADDNEWLINE(2)

  Call Body.EMBEDOBJECT(1454, "", "C:\filename", "Attachment")

  'Example to save the message (optional)

  MailDoc.SAVEMESSAGEONSEND = True

  'Send the document

  'Gets the mail to appear in the Sent items folder

  Call MailDoc.ReplaceItemValue("PostedDate", Now())

  Call MailDoc.SEND(False)

  'Clean Up

  Set Maildb = Nothing

  Set MailDoc = Nothing

  Set Body = Nothing

  Set Session = Nothing

  Note: The Visual Basic programmer needs to set the Reference to use Lotus Domino objects prior to implementing this function. To enable the Lotus Notes classes to appear in the Visual Basic browser, you must execute the following within VB: Select Tools, References and select the checkbox for 'Lotus Notes Automation Classes'.

  Cross Reference information

  Question

  Customers with Microsoft Visual Basic (VB) or VB.NET applications might want to integrate Lotus Notes e-mail functionality. Is there an example of how to create a Notes e-mail from Visual Basic?

  Answer

  The following Microsoft Visual Basic 6 (VB6) code sends a Notes e-mail message. It includes examples of code to include an attachment and to save the sent message, which are both optional and can be removed if desired.

  IMPORTANT NOTE: This is sample code, provided only to illustrate one way to approach this issue. IBM Support will not be able to customize this script for a customer's own configuration. While this may work for some customers it is offered as a suggestion only, and is not something that IBM Lotus software supports further. Dim Maildb As Object

  Dim MailDoc As Object

  Dim Body As Object

  Dim Session As Object

  'Start a session to notes

  Set Session = CreateObject("Lotus.NotesSession")

  'This line prompts for password of current ID noted in Notes.INI

  Call Session.Initialize

  'or use below to supply password of the current ID

  'Call Session.Initialize("")

  'Open the mail database in notes

  Set Maildb = Session.GETDATABASE("", "c:\notes\data\mail\mymail.nsf")

  If Not Maildb.IsOpen = True Then

  Call Maildb.Open

  End If

  'Create the mail document

  Set MailDoc = Maildb.CREATEDOCUMENT

  Call MailDoc.ReplaceItemValue("Form", "Memo")

  'Set the recipient

  Call MailDoc.ReplaceItemValue("SendTo", "John Doe")

  'Set subject

  Call MailDoc.ReplaceItemValue("Subject", "Subject Text")

  'Create and set the Body content

  Set Body = MailDoc.CREATERICHTEXTITEM("Body")

  Call Body.APPENDTEXT("Body text here")

  'Example to create an attachment (optional)

  Call Body.ADDNEWLINE(2)

  Call Body.EMBEDOBJECT(1454, "", "C:\filename", "Attachment")

  'Example to save the message (optional)

  MailDoc.SAVEMESSAGEONSEND = True

  'Send the document

  'Gets the mail to appear in the Sent items folder

  Call MailDoc.ReplaceItemValue("PostedDate", Now())

  Call MailDoc.SEND(False)

  'Clean Up

  Set Maildb = Nothing

  Set MailDoc = Nothing

  Set Body = Nothing

  Set Session = Nothing Note: The Visual Basic programmer needs to set the Reference to use Lotus Domino objects prior to implementing this function. To enable the Lotus Notes classes to appear in the Visual Basic browser, you must execute the following within VB: Select Tools, References and select the checkbox for 'Lotus Notes Automation Classes'.

  Cross Reference information

  Segment Product Component Platform Version Edition

  Messaging Applications Lotus Notes Lotus Notes Windows 8.0, 7.0, 6.5, 6.0, 5.0 All Editions

图文资讯
广告赞助商