3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/asposeemailjava/Email/updateemail.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
email = Rjb::import('com.aspose.email.MailMessage').load(data_dir + "Message.msg")
subject = email.getSubject()
subject = subject + " This text is added to the existing subject"
email.setSubject(subject)
body = email.getHtmlBody()
body = body + "<br> This text is added to the existing body"
email.setHtmlBody(body)
contacts = Rjb::import('com.aspose.email.MailAddressCollection').new
contacts = email.getTo()
contacts.add("[email protected]")
email.setTo(contacts)
contacts = Rjb::import('com.aspose.email.MailAddressCollection').new
contacts = email.getCC()
contacts.add("[email protected]")
email.setCC(contacts)
email.save(data_dir + "UpdateMessage.msg", Rjb::import('com.aspose.email.MailMessageSaveType').getOutlookMessageFormat())
puts "Updated email message Successfully."
end
|