How to send an e-mail with a digital signature?

KalimeruhKalimeruh Member Posts: 12
Hi,

I'm trying to generate e-mail with digital signature attached, i've two accounts setup on my Outlook and one of them uses the digital signature. I'm using the following code :


IF ISCLEAR(OutlookApp) THEN
CREATE(OutlookApp);

OutlookMsg := OutlookApp.CreateItem(0);

OutlookMsg."To"(SendTo);
OutlookMsg.Subject(Subject);
OutlookMsg.Body(Body);
OutlookAttachs := OutlookMsg.Attachments;
OutlookAttachs.Add(AttachPath);

OutlookMsg.SentOnBehalfOfName(SendFrom);

OutlookMsg.Send;

It happens that the sender e-mail always get the default e-mail account. How can i set the sender e-mail account?

Or there is any other way to send e-mail with digital signature from Navision?

Best Regards,

Thank you for your help.

Comments

  • nunomaianunomaia Member Posts: 1,153
    In Outlook 2007 in can make OutlookMsg.SendUsingAccount = Account
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • KalimeruhKalimeruh Member Posts: 12
    But how can i get my account? Can you please give me an example? I already tried to use that property but it doesn't allow me to assign values, maybe because i not getting the correct account.

    Best Regards,
  • nunomaianunomaia Member Posts: 1,153
    Use OutlookApp.Session.Accounts to get account collection
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • KalimeruhKalimeruh Member Posts: 12
    Thank you Nuno. I've this code wich sets my account to the one i want, but when it's sending the e-mail Outlook always gets the default account and not the one i'm setting on "OutlookMsg.SendUsingAccount := OutlookAccount".

    IF ISCLEAR(OutlookApp) THEN
    CREATE(OutlookApp);

    OutlookMsg := OutlookApp.CreateItem(0);

    OutlookMsg."To"(SendTo);
    OutlookMsg.Subject(Subject);
    OutlookMsg.Body(Body);
    OutlookAttachs := OutlookMsg.Attachments;
    OutlookAttachs.Add(AttachPath);

    FOR l_intCount := 1 TO OutlookApp.Session.Accounts.Count DO BEGIN
    OutlookAccount := OutlookApp.Session.Accounts.Item(l_intCount);
    IF UPPERCASE(OutlookAccount.DisplayName) = UPPERCASE(SendFrom) THEN BEGIN
    OutlookMsg.SendUsingAccount := OutlookAccount;
    END;
    END;

    OutlookMsg.Send;

    Best Regards,
  • nunomaianunomaia Member Posts: 1,153
    Did you try to send en e-mail in all outlook accounts to see witch one sends correct e-mail?
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • KalimeruhKalimeruh Member Posts: 12
    Yes, if i try to send with all the accounts it works correctly. But if i try to send with a specific account it always sends with Outlook default account.

    Could you help me?
Sign In or Register to comment.