Send mail from my second mail-account in Lotus Notes

15 pts.
Lotus Notes
Lotus Notes 6.x
Visual Basic 6
Lotus 6.5 / VB6 user In our company, we have created an email account, accessable to some collegues. For some applications (sending an emergency SMS), mail has to be send out from that new address. The email content is automatically generated in VB (using Excel). With the script I use, I don't succeed to send a mail from that other account, but only from my standard email account. database to send from: server: CN=HTMAIL/XXX;O=YYY database: mailincident.nsf I tryed getobject/creatobject and GETENVIRONMENTSTRING/ setGETENVIRONMENTSTRINGvar combinations. In some cases, I get a mailconcept in het right database, but the mail is send from my standard account. The script I start from: Sub mail() Dim objNotesSession As Object Dim objNotesMailFile As Object Dim objNotesDocument As Object Dim objNotesField As Object Dim mail(200) As Variant Dim sms(200) As Variant ''define priority If Cells(4, 3) = "Niv 2 " Then prio = 2 Else: prio = 1 End If ''Verzendingslijst mail(1) = "" mail(2) = "" sms(1) = "" sms(2) = "" '- sends an SMS through Mobileweb ''Connect to LOTUS NOTES Set objNotesSession = GetObject("", "Notes.NotesSession") mail_server = objNotesSession.GETENVIRONMENTSTRING("MailServer", True) mail_file = objNotesSession.GETENVIRONMENTSTRING("MailFile", True) Set objNotesMailFile = objNotesSession.GETDATABASE("", "") objNotesMailFile.OPENMAIL 'Create mail onderwerp = Cells(28, 3) Set objNotesDocument = objNotesMailFile.CREATEDOCUMENT Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo", mail) If prio = 2 Then Set objNotesField = objNotesDocument.APPENDITEMVALUE("CopyTo", sms) Else Set objNotesField = objNotesDocument.APPENDITEMVALUE("CopyTo", "") End If Set objNotesField = objNotesDocument.APPENDITEMVALUE("BlindCopyTo", "") Set objNotesField = objNotesDocument.APPENDITEMVALUE("Subject", onderwerp) Set objNotesField = objNotesDocument.CREATERICHTEXTITEM("Body") With objNotesField .ADDNEWLINE 2 .appendtext Cells(2, 2) 'add lines to complete message End With '' Verify message + confirmation Msg = "Bericht verzenden?" Style = vbOKCancel + vbQuestion Title = "Bevestiging" Response = MsgBox(Msg, Style, Title, Help, Ctxt) If Response = vbOK Then ''Gebruiker koos OK objNotesDocument.Send (0) ''Verstuur e-mail MsgBox "Bericht verzonden" ''Terugmelding naar gebruiker Else ''Gebruiker koos Cancel MsgBox "Bericht geannuleerd" ''Terugmelding naar gebruiker End If ''Release storage Set objNotesSession = Nothing Set objNotesMailFile = Nothing Set objNotesDocument = Nothing Set objNotesField = Nothing end sub

Answer Wiki

Thanks. We'll let you know when a new response is added.


Since you are running this through COM, you still have to log into the server at some point with a user ID. It is likely that Lotus Notes is just sending it this from your email account because you have logged in with it to run you COM application. Whether through COM or straight LotusScript, the Lotus Notes uses the mail properties of who ever is running the code or last signed the agent. Simply choosing to create the document inside of a specific mail database does not mean that the message won’t appear to come from the ID that created the message.

You can try setting the From, Principal and the Replyto field to the email account associated with the mail database, but that does not always work, at least in my experience. Sometimes this is enough, but several SPAM filters today check to see if the person sending the email is the same as the From address and if not, treat it like SPAM.

Another option might be to login to Lotus Notes with an ID and password associated with that mail database via COM. Then when you send an email message Lotus Notes will apply the correct account name. This would mean that each of you users of the Excel file would need a copy of the ID installed on their machine so that they could log into Lotus Notes when prompted by COM with the correct ID.

A third option would be to create the account associated with the mail database and add a scheduled agent that sends out emails based on some criteria you set. Then, via COM, your users can still use Excel to ‘upload’ the message to the mail database. Your schedule agent would check every X minutes to for a new message and then mail it out using the email account associated with the database.

Hope this helps, or at least someone else comes up with a more concrete suggestion.


Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Announcing our September t-shirt winners - ITKE Community Blog
    [...] –> Wcdulanyjr [...]
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: