Subject: Mail.Box Attempted and is successful, but…
… in testing it, I noticed that while the message is saved with the Sender I set up, when the user actually does the message Send, s/he will be recorded as the Sender…
Here is code I followed to guide me, I did not write it, will try to grab the URL as reference. I merely changed what I neeeded there
Sub Click(Source As Button)
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 = "SERVER Production <SERVER Production>"
SenderN = "SERVER Production <SERVER Production>"
subject = "You are saving this email (Send from Inbox)"
SendTo = "me@where.the.wild.things.are.us"
Dim DBMailBox As New NotesDatabase("WhatAGreatServerName", "mail.box")
Dim mail As New NotesDocument( DBMailBox )
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="http://WhatAGreatServerName/develop/BlackberryBulletinBoard.nsf/mylogo.gif" 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 )
'added SentBy coordinates
'@author: Köll S. Cherizard
'@version 2011.11.22.2.54.PM
Call mail.replaceItemValue("Principal", "SERVER Production")
Call mail.replaceItemValue("SentBy", "SERVER Production")
Call mail.replaceItemValue("DisplaySent", "SERVER Production")
'MailDoc.SentBy = "SERVER Production"
'MailDoc.DisplaySent = "SERVER Production"
'Since we created the mail in the mail.box, we just need to save it, not send it!
Call mail.Save(True,False)
s.ConvertMIME = True ' Restore conversion
End Sub
Thanks again for your help. This may be the best option.
Update: I just added Send instead of Save thus to send the mail straight away, it worked but I got some pop ups, if I could rid of the those, we should be good. Here’s what pops up:
(1)You have requested to sign this Internet message, but your current ID does not contain “Certificate”, “This that and the other” … then OK/CANCEL options
(2)Type mismatched on external name: UIMEMODOCUMENT
(3)A stored form cannot contain computer forms
(4)Variant dopes not contain an object
Scheduling probably will not fly for this item.
Can this be helped, sounds like it wants a legal email address and cannot use the group name SERVER Production.
What are your thoughts?