We help IT Professionals succeed at work.
Get Started

Send Automated Lotus Notes mail from VB Authored by Other Person

Last Modified: 2013-12-18
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 Function
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE