def run(): dataDir = "Data/" #ExStart: CreateNewMessagesToThunderbird # Initialize MboxStorageWriter and pass the above stream to it writer = MboxrdStorageWriter(dataDir + "ExampleMBox_out.mbox", False) # Prepare a new message using the MailMessage class message = MailMessage("*****@*****.**", "*****@*****.**", "Eml generated for Mbox", "added from Aspose.Email for Python") message.is_draft = False # Add this message to storage writer.write_message(message) # Close all related streams writer.dispose()
def run(): dataDir = "Data/" #ExStart: CreatingMSGFilesWithRtfBody eml = MailMessage() eml.is_draft = True # Create an instance of the MapiMessage class and pass MailMessage as argument outlookMsg = MapiMessage.from_mail_message(eml) # Set RTF Body outlookMsg.body_rtf = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Calibri;}}\r\n{\\*\\generator Msftedit 5.41.21.2510;}\\viewkind4\\uc1\\pard\\sa200\\sl276\\slmult1\\lang9\\f0\\fs22 This is RTF Body with this \\b bold \\b0 text.\\par\r\n}\r\n\0" # Save the message (MSG) file strMsgFile = "CreatingMSGFilesWithRtfBody_out.msg" outlookMsg.save(dataDir + strMsgFile);
def run(): dataDir = "Data/" #ExStart: DeleteVotingButtonFromMessage message = MapiMessage.from_file("message.msg") FollowUpManager.add_voting_button(message, "Indeed!") message.save(dataDir + "AddVotingButtonToExistingMessage_out.msg") eml = MailMessage("*****@*****.**", "*****@*****.**", "Subject", "Body") eml.is_draft = False msg = MapiMessage.from_mail_message(eml) options = FollowUpOptions() options.voting_buttons = "Yes;No;Maybe;Exactly!" FollowUpManager.set_options(msg, options) msg.save(dataDir + "MapiMsgWithPoll.msg") FollowUpManager.remove_voting_button(msg, "Exactly!") #Deleting a single button OR FollowUpManager.clear_voting_buttons( msg) # Deleting all buttons from a MapiMessage msg.save(dataDir + "MapiMsgWithPoll_out.msg")