Konwertowanie wiadomości e-mail w Ruby

Aspose.Email - Konwertowanie wiadomości e-mail

Aby skonwertować wiadomości e-mail przy użyciu Aspose.Email Java for Ruby, wywołaj metodę convert_eml_to_msg modułu Converter. Poniżej znajduje się przykładowy kod.

Kod Ruby

def convert_eml_to_msg()    
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
    # Initialize and Load an existing EML file by specifying the MessageFormat
    eml = Rjb::import('com.aspose.email.MailMessage').load(data_dir + "Message.eml")
    # Save the Email message to disk in Unicode format
    eml.save(data_dir + "AnEmail.msg", Rjb::import('com.aspose.email.SaveOptions').getDefaultMsgUnicode())
    # Display Status
    puts "Converted eml to msg successfully."
end

Pobierz działający kod

Pobierz Converting Email Messages (Aspose.Email) z dowolnej z poniżej wymienionych platform kodowania społecznego: