How to embed report in HTML format into the message and send by e-mail using a code?

Question: How to embed report in HTML format into the message and send by e-mail using a code?

Answer:

Use this snippet for it:

1
2
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
Report report = new Report();
 report.LoadPrepared("preparedreport.fpx");
 
 HTMLExport htmlExport = new HTMLExport()
 {
 SubFolder = false,
 Navigator = false,
 Pictures = true,
 EmbedPictures = true,
 SinglePage = true,
 Layers = true,
 HasMultipleFiles = false
 };
 EmailExport email = new EmailExport();
 
 //email mailer settings
 email.Account.Address = "Email@gmail.com";
 email.Account.Name = "Usename";
 email.Account.Host = "smtp.yandex.ru";
 email.Account.Port = 25;
 email.Account.UserName = "Email";
 email.Account.Password = "password";
 email.Account.MessageTemplate = "Test";
 email.Account.EnableSSL = true;
 
 //email addressee settings
 email.Address = "Destinationaddress@gmail.com";
 email.Subject = "Embedding of html";
 
 email.Export = htmlExport; //Set export type
 email.SendEmail(report); //Send email