30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/mail_mcp/tools/send_mail_message_tool.rb', line 30
def self.call(to:, subject:, text_body:, server_context:, cc: nil, bcc: nil, html_body: nil,
attachment_urls: [], folder: "Sent")
mail = MailBuilder.build(
from: server_context.imap_config[:username],
to: to, subject: subject, text_body: text_body,
cc: cc, bcc: bcc, html_body: html_body,
attachment_urls: attachment_urls
)
SmtpClient.send(server_context.smtp_config, mail)
ImapClient.connect(server_context.imap_config) { |c| c.append_message(folder: folder, raw_message: mail.to_s) }
MCP::Tool::Response.new([{ type: "text", text: "Email sent successfully to #{to} and saved to #{folder}" }])
end
|