Sending an email with a custom “sender” with Lotus Notes/Domino


I recently had the need to send an email from a Notes application where the sender wasn’t going to be me, nor the agen’t signer.   I tried many methods I’d found on the forums, on the many articles, on help from twitter, and finally, by opening a PMR with Lotus support, only to be told that IBM/Lotus won’t help me because it is spoofing.

I am not spoofing anything. I have a legitimate business need to send out emails, where there is no mention of the user performing the action, nor the signer of an agent, nor the server’s id either.

If I set the mail document’s fields, nothing should be changing them.

Dim mysender As String, mysenderN As String
mysender = ""
mysenderN = mysender & "@NotesDomain" 'Needed for internal routing only
maildoc.From = mysenderN
maildoc.SMTPOriginator = mysender
maildoc.Sender = mysender
maildoc.Principal = mysenderN
maildoc.INETFROM = mysender
maildoc.send (true,false)

If I stop the router, and look at the document in the, the INETFROM shouldn’t be different, but it is, and it is my email address, well, the address associated with my .id file.

I see far too many posts and things about this in the forums.  I’ve looked and looked, but couldn’t spot how to accomplish this.  Well, I finally read it somewhere, and I can’t remember where, but put simply, if you are working in the, don’t use the “send” method, simply use the “save” method, and voilà, the mail will leave how you programmed it.

This is my example code for sending a MIME email, with a “spoofed” sender using Lotus Notes/Domino 8.5. Is it perfect – no, but it does work for me…

Dim s As New NotesSession Dim Subject As String, SendTo As String Dim Sender As String, SenderN As String 'the address you want the mail to appear to be from Sender = "FName LName <>" SenderN = "FName LName <>" 'Alternatively, you could just use: 'Sender = "" 'SenderN = Sender & "@NotesDomain" subject = "This is the subject line" SendTo = "" Dim DBmbox As New NotesDatabase("servername", "") Dim mail As New NotesDocument( DBmbox ) s.ConvertMIME = False ' Do not convert MIME to rich text Dim body As NotesMIMEEntity Dim header As NotesMIMEHeader Dim stream As NotesStream Dim child As NotesMIMEEntity Set stream = s.CreateStream Set body = mail.CreateMIMEEntity Set header = body.CreateHeader({MIME-Version}) Call header.SetHeaderVal("1.0") Set header = body.CreateHeader("Content-Type") Call header.SetHeaderValAndParams({multipart/alternative;boundary="=NextPart_="}) 'Add the to field Set header = body.CreateHeader("To") Call header.SetHeaderVal(SendTo) 'Add Subject Line Set header = body.CreateHeader("Subject") Call header.SetHeaderVal(subject) 'Add the body of the message Set child = body.CreateChildEntity Call stream.WriteText("<p>") Call stream.WriteText("<font face=Verdana color=#0288C1 size=3>") Call stream.WriteText(|<div class="headerlogo">|) 'If you are referencing any external files, images, javascript, you must use a fully qualified URL/Path Call stream.WriteText (|<img src="" alt="SomeLogo">|) Call stream.WriteText(|</div></font>|) Call stream.WriteText(|...some more HTML |) Call child.setContentFromText(stream, {text/html;charset="iso-8859-1"}, ENC_NONE) Call stream.Truncate 'Not sure if I need this Call stream.Close Call mail.CloseMIMEEntities(True) Call mail.replaceItemValue("Form", "Memo") Call mail.replaceItemValue("Recipients", SendTo) Call mail.replaceItemValue( "From", SenderN ) Call mail.replaceItemValue( "InetFrom", Sender ) 'Since we created the mail in the, we just need to save it, not send it! Call mail.Save(True,False) s.ConvertMIME = True ' Restore conversion
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at