The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Hi;

I figured out how to send html emails, however I'm not sure how to send embedded images in HTML emails (images that were instered by "ins ert image" command from html menubar).

I can see how to get the images and save in to local storage (there's example in Managed Application demo), but don't know how to embed them in html email in 1C (inline attachment).

Can I ask for advice?

Edited: Joanna Light - Aug 25, 2014 03:32 AM
 
#2
People who like this: 1 Yes / 0 No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

Try use ProcessTexts. This method need that you save images in to local storage

Code
// Create post profile
profile= New InternetMailProfile; 
profile.SMTPServerAddress = ...; 
profile.POP3ServerAddress = ...; 
...
// Create mail message
MailMessage=New InternetMailMessage; 
MailMessage.From = ...; 
MailMessage.Subject="Message with image"; 
MailMessage.To.Add(...);
...
Some_Text =  "
|<h3>  Hi !</h3>
|This is message with embedded image.<br />
|Image:<br  />
|<img  src=""file:///C|/test/pic.png"" /><br />
|End.
|";
MailMessage.Texts.Add(Some_Text, InternetMailTextType.HTML);
MailMessage.ProcessTexts();

// Create Internet mail and send message
Mail = New InternetMail; 
Mail.Logon(profile); 
Mail.Send(MailMessage); 
Mail.Logoff();

 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Hi;

Yes, it adds images to the body of the message and also adds them to attachments, it's also default to the method Send() to process the text. Thank you! :)

But I had to save the images to a local hard drive directory ( I used TempFilesDir() ) because when I tried to use temp storage PutToTempStorage(), there was an error "directory couldn't be found".

Does it work for you when using temp storage or local hard drive is the only option?

 
#4
People who like this: 1 Yes / 0 No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

As I know, It will be work only for images from local hard drive. PutToTempStorage() and network storage dont work too

 
#5
People who like this: 0 Yes / 0 No
Active user
Rating: 3
Joined: Sep 2, 2013
Company:

Thank you very much for answers! :)

 
Subscribe
Users browsing this topic (guests: 2, registered: 0, hidden: 0)