Sending picture in the body of an email

finderfinder Member Posts: 129
Hi,

Is it possible in NAV 5.0 to send an email with picture but not as an attachment but in the body of an email. I used CU SMTP Mail for sending emails and it works properly but didn't find that kind of possibility.

Thanks in advance,
Anti

Answers

  • imurphyimurphy Member Posts: 308
    I've never tried to do this from Nav but an email with an embedded image is nothing more than an html file with the image mime encoded and a marker in the body of the message which says display attachment xxx here.

    Its a bit labourious but constructing the html is not difficult. The html you construct is simply the body of the message.

    Create an email in outlook and examine the structure and you can see what you are aiming for.

    Alternately, if you are using an exchange server you have the CDO api which allows you to do this. Mapi may do as well but its not so flexible.

    Ian
  • jlandeenjlandeen Member Posts: 524
    Codeunit 400 (SMTP) does have functionality to build up the body (AppendBody function) of the email and attach files (AddAttachment function). These 2 functions coupled with the HTMLBody flag at the end of the CreateMessage function are what I would play with to try and send out a picture in an email. You will to construct all the HTML in text (or maybe read it from a file/template) and then just refer to the attachment.

    This should make it a little cleaner and you don't have to worry about mucking about with automation variables.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • JPHSCJPHSC Member Posts: 67
    Try this ...
    lcduMail.CreateMessage(SenderName,SenderAddress,Recipients,Subject,Body,TRUE)
    lcduMail.AddAttachment('c:\MyPicture.jpg');
    lcduMail.AppendBody('<img src="cid:MyPicture.jpg">');
    lcduMail.Send;
    
  • finderfinder Member Posts: 129
    Thanks, it was working just the way I wished and without additional OCX or automations :)
Sign In or Register to comment.