Advertisement

07.14.2008 at 09:41AM PDT, ID: 23563241
[x]
Attachment Details

Send Automated Lotus Notes mail from VB Authored by Other Person

Asked by UPRRDevelopers in Lotus Notes, Visual Basic Programming

I am trying to send an email out of my mailbox with a different "From" field than my own name.  This is so when the user replies to the mail, it will go to another mailbox, not mine.  This is the code I have written.  The memo is created and is saved in my "All Documents" folder, the To field shows the recipient, and the From field shows the correct value.  I can open the note and send it myself, but I need it to automatically send when this function runs.  

If I change the code to doc.send, the doc is sent, but it always reverts back to my name in the From field.  I was told that I needed to "Save" the doc and make the PostedDate field read the current date to make this work.  Well, it saves in perfect format, but doesnt send.  What am I doing wrong?  Thanks.

Public Function SendNotification(Subject As String, Body As String, SendTo As String, NotifyType)
Dim Session As New Domino.notessession
Dim dir As Domino.NotesDbDirectory
Dim db As Domino.NotesDatabase
Dim doc As Domino.NotesDocument
Dim object As Domino.NotesEmbeddedObject
Dim rtitem As Domino.NotesRichTextItem

    Call Session.Initialize("password")
    Set dir = Session.GetDbDirectory("/server/file")
   
    Set db = dir.OpenMailDatabase
    Set doc = db.CreateDocument
    Call doc.AppendItemValue("Form", "Memo")
    Call doc.AppendItemValue("SendTo", SendTo)
    Call doc.AppendItemValue("From", "Department Auditor")
    Call doc.AppendItemValue("Subject", Subject)
    Call doc.AppendItemValue("PostedDate", Format(Now, "mm/dd/yyyy"))
    Set rtitem = doc.CreateRichTextItem("Body")
    rtitem.AppendText (Body)
    doc.SaveMessageOnSend = True
    Call doc.Save(False, False)

    Set db = Nothing
    Set Session = Nothing

End FunctionStart Free Trial
[+][-]07.14.2008 at 11:53AM PDT, ID: 22000879

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Lotus Notes, Visual Basic Programming
Sign Up Now!
Solution Provided By: mbonaci
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.14.2008 at 02:11PM PDT, ID: 22002171

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.17.2008 at 06:04AM PDT, ID: 22024921

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628