Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Can you change the From part of an email?

I've got a database which pulls in information from email inbox and then replies to it. My reply email works fine but what I want to do is to be able to change the From part of the email so that it doesnt appear to be from the email address but from a different one.

My code is shown below (function createmail) and this is the line I want to add in but I don't know the actual name of the notesitem for From - I've tried using From but that doesnt change the From address.

szTempString = NewMail.AppendItemValue("From", "UK Fleet and Facilities")

What I'd like to know is, is it possible to change the From address to show something else and if so how?

Thanks for any help

Function CreateMail(subj, msg, Person)
Dim rtitem As Variant
Dim szTempString
Dim NewMail As NotesDocument
Dim session As NotesSession
Dim db As NotesDatabase

Set session = CreateObject("Lotus.notessession")
Call session.Initialize("password")
Set db = session.GetDatabase("mailserver", "mailfile.nsf", False)

Set NewMail = db.CreateDocument

szTempString = NewMail.AppendItemValue("Form", "Memo")
szTempString = NewMail.AppendItemValue("Subject", subj)
szTempString = NewMail.AppendItemValue("SendTo", Person)

NewMail.CreateRichTextItem ("Body")
Set rtitem = NewMail.GetFirstItem("Body")
rtitem.AppendText (msg)
'Send the message
NewMail.Send (False), (Person)
end function
1 Solution
Sjef BosmanGroupware ConsultantCommented:
If it's Notes mail, then it's the signer of the agent who sends the mail. You can only try to use the person's id to send the mail.

If it's Internet mail, you could set the field Principal to the intended sender's name. In some cases, you also need to set the field INetFrom to the same name.
Just say
NewMail.Principal = "<whatever name you want>"
Newmail.replyto = "<whatever name you want the user to reply to>"

ProfJamesAuthor Commented:
fantastic!! I tried Prinicipal and it worked!! thanks very much, dont know why it didnt occur to me to use principal in the first place cos thats what I use to extract the senders name when the db first receives the email!

anyway thanks again.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now