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("passwo
rd")
Set dir = Session.GetDbDirectory("/s
erver/file
")
Set db = dir.OpenMailDatabase
Set doc = db.CreateDocument
Call doc.AppendItemValue("Form"
, "Memo")
Call doc.AppendItemValue("SendT
o", SendTo)
Call doc.AppendItemValue("From"
, "Department Auditor")
Call doc.AppendItemValue("Subje
ct", Subject)
Call doc.AppendItemValue("Poste
dDate", Format(Now, "mm/dd/yyyy"))
Set rtitem = doc.CreateRichTextItem("Bo
dy")
rtitem.AppendText (Body)
doc.SaveMessageOnSend = True
Call doc.Save(False, False)
Set db = Nothing
Set Session = Nothing
End Function
Start Free Trial