I’m trying to send an email that contains HTML… The mailer works fine internal but as soon as I send it external (gmail or yahoo) it sends fine but the user gets ‘unknown sender’ as the sender… Anyone got any ideas? here is my code
'Declare Variables
Dim s As New NotesSession
Dim db As NotesDatabase
Dim body As NotesMIMEEntity
Dim stream As NotesStream
Dim requestor As String
requestor = "Automated_Messenger@mydomain.com"
Set db = s.CurrentDatabase
'Determine where Script is running & Setup URL Accordingly.
'Capture the server name and filepath for use in URLs
s.ConvertMIME = False ' Do not convert MIME to rich text
Set stream = s.CreateStream
'Begin creating the message doc to send
Dim message As New NotesDocument (db)
message.Form="memo"
Set body = message.CreateMIMEEntity
'Basic profile of email
message.Subject = Subject
message.SendTo = SendTo
message.CopyTo = CopyTo
message.principal = requestor
message.~$INetPrincipal= requestor
message.SentBy = requestor
message.FROM = requestor
message.INETFROM = requestor
message.Sender = requestor
message.RecNoOutOfOffice = "1" 'Set it so out of office agents don't reply to the message
'Open the HTML (Title doesn't matter since it doesn't appear anywhere)
Call stream.WriteText ("<html><head><title>E-Mail</title>")
'BEGIN: Inline Stylesheet
Call stream.WriteText (|
<style type="text/css">
<!--
.text, td, tr, p, br, body {
COLOR: #666666;
FONT-FAMILY: Arial, Helvetica, sans-serif;
FONT-SIZE: 12px;
}
a {
font-family: Arial, Helvetica, sans-serif;
color: #663399;
FONT-WEIGHT: bold;
text-decoration: none;
}
-->
</style>
|)
' END: Inline Stylesheet
Call stream.WriteText ({</head>})
Call stream.WriteText ({<body text="#666666" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">})
'BEGIN: HTML body
Call stream.WriteText(mybodyHTML)
'END: HTML body
'Close the HTML
Call stream.WriteText ({</body></html>})
'Ensure the MIME content will be recognized as HTML (Must be after the stream is written)
Call body.SetContentFromText (stream, "text/html;charset=iso-8859-1", ENC_NONE)
'Send the email
Call message.Send (False)
s.ConvertMIME = True ' Restore conversion