如何将Mail-in数据库邮件自动转发至Lotus群组?批量转发可行吗?
1. Automatically Forwarding Emails from 300+ Mail-in Databases to Lotus Groups
Since manual rules are totally impractical for this scale, scalable LotusScript agents are your go-to solution. Here's a step-by-step breakdown:
Build a Reusable Forwarding Agent
Create an agent in Domino Designer that triggers when new mail arrives. The core logic handles grabbing incoming messages, copying them, and sending to your target group. Here's a simplified script snippet to start with:Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Dim col As NotesDocumentCollection Dim doc As NotesDocument, newDoc As NotesDocument Dim targetGroup As String Set db = s.CurrentDatabase targetGroup = "YourTargetLotusGroup" ' Replace with your actual group name ' Fetch unprocessed new emails Set col = db.UnprocessedDocuments If col.Count = 0 Then Exit Sub Set doc = col.GetFirstDocument() Do Until doc Is Nothing ' Create a copy of the email to forward Set newDoc = doc.CopyToDatabase(db) ' Clear existing recipients and set target group Call newDoc.RemoveItem("SendTo") Call newDoc.RemoveItem("CopyTo") Call newDoc.RemoveItem("BlindCopyTo") newDoc.SendTo = targetGroup ' Add a subject prefix for clarity newDoc.Subject = "[Forwarded from " & db.Title & "] " & doc.Subject ' Send the forwarded email Call newDoc.Send(False) ' Mark original as processed to avoid re-forwarding doc.Processed = "1" Call doc.Save(True, False) Set doc = col.GetNextDocument(doc) Loop End SubDeploy the Agent to All Mail-in Databases
Skip manual setup with these scalable deployment methods:- Template Sync: If your Mail-in databases are based on a shared template, update the template with the agent and sync all DBs via Domino Administrator.
- Scripted Deployment: Write a separate LotusScript agent that runs on your server, iterates over all Mail-in databases (filter by title/category), and copies the forwarding agent into each one.
- Domino Policies: Use a mail policy to push the agent to all target databases, though this is less flexible than direct template/scripted deployment.
Critical Permission Check: Ensure the agent runs with sufficient access—set it to run as the server or as a user with read/write access to all Mail-in DBs and permission to send mail on their behalf.
2. Can You Forward from the Mail-in Database's Email Address to a Lotus Group?
Absolutely—you just need two key configurations:
Allow Agent to Send on Behalf of the Mail-in DB
In the agent's properties (Domino Designer > Security tab), select "Run on behalf of the database owner" or check the option to "Allow this agent to send mail on behalf of the database" (exact wording varies by Domino version).Set the Forwarded Email's Sender Address
Add these lines to your LotusScript before sending the email to ensure it appears to come from the Mail-in database's official address, not the agent's runtime user:newDoc.From = "your-mail-in-address@yourdomain.com" ' Replace with your Mail-in address newDoc.Principal = "your-mail-in-address@yourdomain.com" ' Ensures proper display in recipients' inboxesDouble-check that the Mail-in database has its correct email address assigned in Domino Administrator, and that your server doesn't restrict sending from that address.
内容的提问来源于stack exchange,提问作者Robert Lewi Kiedrowski

