none
Sending Outlook Tasks to SMTP recipients RRS feed

  • Question

  • I'm writing a task management app using Excel VBA. The app creates outlook tasks and sends them to recipients. This works fine when the recipients are within the Exchange domain however it does not work when sending the tasks to users outside of the Exchange domain via SMTP.

    The problem is that Outlook is converting the task into plain text with attachments, even though outlook is configured to send messages to that recipient as RTF.

    So if I manually create the task in outlook it correctly sends the task as RTF, but if I create it using VBA outlook ignores the configuration for that recipient and just sends a meaningless email with the task as a plain text attachment, which actually omits the first 10 or so characters from each line, so it's totally meaningless to the recipient. How can I get around this?

    Sunday, December 3, 2017 10:17 AM

All replies

  • Are you using WordEditor to do it?  I have not done it with a task but it might be worth trying.
    Monday, December 4, 2017 1:20 AM
  • Hello,

    Do you get any error when sending tasks to users outside of your domain? 

    Could you please share your code here to help us reproduce your issue? 

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 4, 2017 1:43 AM
    Moderator
  • Here's a flavour of what I'm doing:

    Dim objTask as Outlook.TaskItem. pbjTaslFolder as Outlook.MAPIFolder
    Dim ONS as Outlook.Namespace
    Dim O as Outlook.Appication
    
    Set O = New Outlook.Application
    Set ONS = O.GetNamespace("MAPI")
    Set objTaskFolder = ONS.GetDefaultFolder(olFolderTasks)
    
    Set objTask = objTaskFolder.Items.Add(olTaskItem)
    
    With objTask
       .Subject = "Task Title"
       .StartDate = Date
       .DueDate = Date + 5
       .Assign
       .Recipients.Add Name:="User@mail.com"
       .Save
       .Send
    End With
    
    Set O = Nothing
    Set ONS = Nothing
    Set ObjTaskFolder = Nothing
    Set objTask = Nothing

    This works fine when sending within the same exchange domain, but if you are trying to reach someone outside of your domain via SMTP outlook automatically sends it as text. Somehow I need to change this behaviour. Outlook as standard does the same, unless you have changed the default setting for that contact it will send the task as a Text email with an attachment that the Outlook on the other side cannot understand.

    Wednesday, December 6, 2017 7:36 PM
  • Hello,

    >>if I manually create the task in outlook it correctly sends the task as RTF

    What settings do you change if it shows correct when you send manually to users outside your domain?

    If you send a task request to users outside your domain, the task request should be sent as a normal mail item with attachment as shown below. I think it is by design and it is the same result no matter sending manually or programmatically.

    You may visit the similar thread: 

    Assigned task shows as regular e-mail with text (is not recognizes as task) - Outlook 2010 + Exchange

    In this thread Domel shared his workaround. Are you doing similar settings? 

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 7, 2017 7:11 AM
    Moderator
  • I went to File>>Options>>Email>>Message Format>>When sending RTF format messages to Internet Recipients>>Send using Outlook Rich Text Format. That pc is not in an exchange domain and it can send outlook tasks correctly to a client within an exchange domain. However, when Outlook marks the task as accepted, it returns the task in text format, even though it too is set to send RTF messages to Internet clients in RTF Format.
    Thursday, December 7, 2017 7:37 AM
  • Thanks for the information. However I failed to reproduce your issue. All received tasks are as a normal mail item with an attachment. I try to send a task from @Microsoft.com to @Outlook.com and also try to configure the @outlook.com mail as POP/SMTP in Outlook and send tasks, but all received tasks are as the picture above. Am I wrong in the test steps? Could you please share detail repro steps?

    Besides, I notice you post a new thread. For the old thread:https://social.msdn.microsoft.com/Forums/office/en-US/905cb38d-e504-4f90-b98e-ecd2f76c8210/outlook-task-transitions?forum=outlookdev  if the issue has been resolved, we do appreciate if you could share your solution and mark it as answer to close that thread. 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 7, 2017 8:33 AM
    Moderator
  • That's interesting. All I can say is that I have one pc using outlook 2016 which is connected via SMTP and outside of the Exchange domain that can send a task to another machine which is in an exchange domain and running Outlook 2013. both versions of outlook are configured to send RTF mails in RTF format to Internet connections.

    The 2016 pc sends the task as RTF and the 2013 pc picks it up correctly as a Task. However the task acceptance mail from the 2013 pc is sent out as text and is not recognised by the 2016 outlook. So it half works, this is without using any VBA, just adding the tasks manually in Outlook.

    My other thread is relating to tasks sent between PC's in the same exchange domain, so has nothing to do with this issue.

    Thursday, December 7, 2017 12:01 PM
  • Thanks for the information. For this issue about sending tasks for different domain, as you get the same result when sending tasks manually, it indicates the issue is not related to code but Outlook feature, I suggest you post on https://social.technet.microsoft.com/Forums/office/en-US/home?forum=outlook



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 8, 2017 7:01 AM
    Moderator
  • Thanks, however my 2016 Outlook machine is not enjoying being sent tasks this way. Every time I send a task to it the mailbox stops being able to send and receive. The only way to fix it seems to be to delete the account in Outlook and then reinstall it. So I think I'll give up trying to connect with Internet based machines for a while.
    Wednesday, December 13, 2017 8:10 PM
  • Hello,

    It seems that you fail to send task manually. I suggest you post the issue on https://social.technet.microsoft.com/Forums/office/en-US/home?forum=outlook forum as it is not related to program or code. The community members and supporters in that forum are more professional to product issues. If you have any issues related to use Outlook Object Model, please feel free to post threads on our forum.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 14, 2017 7:08 AM
    Moderator