How to send Lotus Notes mail messages with Microsoft Visual Basic

Source: Internet
Author: User
Question
MERs 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 des 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 restrict strate 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 MERs 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 ("<password> ")
    '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 class '.

 
 
 
 
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

 

Question
MERs 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 des 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 restrict strate 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 MERs 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 ("<password> ")
    '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 class '.

 
 
 
 
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

 
Question
MERs 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 des 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 restrict strate 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 MERs 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 ("<password> ")
    '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 class '.

 
 
 
 
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

 
Question
MERs 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 des 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 restrict strate 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 MERs 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 ("<password> ")
    '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 class '.

 
 
 
 
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

 

Question
MERs 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 des 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 restrict strate 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 MERs 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 ("<password> ")
'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 class '.

 
 
 

 
Cross reference information
Segment product component platform version Edition
Messaging applications Lotus Notes windows 8.0, 7.0, 6.5, 6.0, 5.0 all editions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.