Autoreply either doesn't contain a subject, doesn't allow newlines, or is "from" servername

I have a customer service mailbox set to receive mail from the outside and autogenerates a reply “your email has been received …”

If I use a “Reply To Sender” simple action:

A. I cannot insert newlines and the text just spaces itself out randomly (if I insert spaces) or just runs together in one long string.

B. It does not have a subject line.

If I use the @MailSend function, the “From” field shows the server name, not the mailbox owner.

If I use script, I can’t set the agent to run when mail is received.

Any way to get:

A. “Re: ” as the original subject line.

B. From: “ACME Customer Service” as the sender and

C. Format the text so I can control the breaks/newlines?

TIA,

-MC

Subject: Autoreply either doesn’t contain a subject, doesn’t allow newlines, or is “from” servername

Sub Initialize

Dim ns As New NotesSession

Dim db As NotesDatabase

Dim note As NotesDocument

Dim doc As NotesDocument

Set db = ns.CurrentDatabase

Set doc = ns.DocumentContext

Set note = db.CreateDocument

note.Form = "Memo"

note.PRINCIPAL = "ACME Customer Service"

note.Subject = "RE: " & doc.Subject(0)

note.Body = "ACME Customer Service will respond to you within 24 to 48 hours." & Chr(13) &_

"If this is an emergency, please call 1-800-800-8888" & Chr(13) & Chr(13) &_

"Important Note:" & Chr(13) & Chr(13) &_

"Questions related to personal information changes and manager changes " & Chr(13) &_

"must be sent directly to:  hr@acme.com." & Chr(13) & Chr(13) &_

"Questions regarding your paycheck " & Chr(13) &_

"must be sent directly to:  payroll@acme.com."

Recipients = doc.From(0)

Call note.Send(False, Recipients)

End Sub

Subject: RE: Autoreply either doesn’t contain a subject, doesn’t allow newlines, or is “from” servername

Thanks for the code Paul,

I copied, pasted, and modified the text as appropriate and sent a message from my Notes client.

The agent log said it ran but I received no return email.

I ran the agent through the debugger and the line:

Set doc = ns.DocumentContext

returns no value for doc

therefore the line:

note.Subject = "RE: " & doc.Subject(0)

returns an "object variable not set error

any idea why?

thks,

-MC

Subject: RE: Autoreply either doesn’t contain a subject, doesn’t allow newlines, or is “from” servername

the same code is running for me in production right now with no issues. server version is the same, 7.0.2

Subject: Autoreply either doesn’t contain a subject, doesn’t allow newlines, or is “from” servername

Michael,

I use LS when I have this need. I set the agent to run against newly received mail, and I just code everything I need right there.

Then I either set the agent to run on behalf of xyz, and then it’ll be from that person, or I drop the mail right into mail.box in order to get that level of control. Sometimes one method is more practical than the other.

regards,

raphael