Creating an HTML Mailer and getting 'unknown sender' on outside emails

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

Subject: Creating an HTML Mailer and getting ‘unknown sender’ on outside emails

How is the script run? As an agent? From the UI? The ‘From’ is set from the Agent signer’s internet address in the person document of the domino directory. If its from the UI, it should be ‘from’ the user…

Jeremy

http://www.zetaone.com/jeremy/hodgebloge.nsf

Subject: RE: Creating an HTML Mailer and getting ‘unknown sender’ on outside emails

I’ve gotten the issue with not sending outside mails fixed (We had a surfcontrol server setting wrong)… I’ve test another agent from another database and it sets the From fine on outside mails… So I use the code from it and tried again and am still getting “unknown sender” the only major difference is that in the working agent I am not doing a mime mail but the “unknown sender” one is.

Subject: 551 This is not a relay host - mail must be to or from host domain.

It was from the ui but it wasn’t sending from me… I’ve moved it to an agent that runs on the server and now i get ‘551 This is not a relay host - mail must be to or from host domain.’

when it tries to send outside the domain… Any idea why?

Subject: RE: 551 This is not a relay host - mail must be to or from host domain.

Your SMTP Outbound relay controls set in your Messaging settings are prohibiting relaying of mail from a domain other than what your domino server is set up as. Either create a Global Domain Document with, adding the additional domain that you are trying to send, OR, modify the Messaging Settings to allow the domino to realy from trusted sources (such as the local network) … most secure way is to modify/create your Global Domain Document…

jeremy

http://www.zetaone.com/jeremy/hodgebloge.nsf