none
Ms Outlook transforms To address RRS feed

  • Question

  • Hello,

    in the company where I work we have a Zetafax server which receives emails in input and sends them via fax to the number specified in the TO email field. The format for the TO field which we use from Ms Outlook is "[FAX:@faxnumber]" (example [FAX:@0755822514]). The Zetafax server receives the email via our Ms Exchange 2003 server and sends it via fax to the fax number specified. This all works fine.

    Now the problem arises when I need to send emails to Zetafax from code. I've tried sending emails through System.Net.Mail.SmtpClient and through HTTP DAV. The problem is the same: the TO address format is invalid. When I use SmtpClient an exception is thrown from code, while when I use the HTTP method, the Ms Exchange server sends me a reply saying that it was unable to reach the recipient due to an incorrect address format.

    I then tried sending an email to Zetafax from another email client (Mozilla Thunderbird) using the same address format ([FAX:@faxnumber]) and I keep getting "5.5.4 Invalid Address" from the server. I tried removing the brackets, the colon, etc, but still the same problem.

    After all this I'm assuming Outlook transforms the string [FAX:@0755822514] into something else to make it correct for the Exchange server. I was unable to see this correct format even by trying to view the message source. Does anybody know what string format one is supposed to use in this case?

     

    Thanks.

     

    E

    Friday, January 20, 2012 9:43 AM

Answers

  • If Outlook shows the custom address type (FAX as iopposed to SMTP), the message (or rather fax) is sent through a custom transport provider installed in Outlook. Since it is installed in Outlook, you can only send through it if you are using the Outlook Object Model, Extended MAPI, or a library that wraps Extended MAPi (such as Redemption).
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    • Marked as answer by ErionPC Friday, January 20, 2012 2:32 PM
    Friday, January 20, 2012 2:24 PM

All replies

  • maybe try to use OutlookSpy and investigate MAPI properties on mail in sent items folder - compare it to normal mail (sent to email address)
    Friday, January 20, 2012 10:31 AM
  • No joy :(
    Friday, January 20, 2012 11:23 AM
  • I gave up and used Microsoft.Office.Interop.Outlook. Id doesn't make much sense that System.Net doesn't give you the possibility to specify an alternative address space (FAX) for an email message.

    Please correct me if I'm mistaken

     

    Friday, January 20, 2012 12:53 PM
  • if you enter that fax in outlook's GAL search field, does it show some result? what does it resolve into?
    Friday, January 20, 2012 1:01 PM


  • As can be seen from the image, the adress space is FAX.
    Friday, January 20, 2012 1:31 PM
  • try writing following code (either in add-in or VBA)

     

    recipient  = Application.Session.CreateRecipient("FAX:@0755822514")

    recipient.Resolve();

     

    and check its AddressEntry - is it filled? If so, what is its AddressEntryUserType?

    Friday, January 20, 2012 1:45 PM
  • Maybe I didn't make myself clear,

    I solved the problem using Microsoft.Office.Interop.Outlook.

    using OutlookApp = Microsoft.Office.Interop.Outlook;
    
    /* ... */
    
     OutlookApp.Application app = new OutlookApp.Application();
                    OutlookApp.MailItem message = (OutlookApp.MailItem)app.CreateItem(OutlookApp.OlItemType.olMailItem);
                    message.To = to;
                    message.CC = cc;
                    message.BCC = bcc;
                    message.Subject = oggetto;
                    if (isHtml)
                    {
                        message.HTMLBody = testo;
                    }
                    else
                    {
                        message.Body = testo;
                        message.BodyFormat = OutlookApp.OlBodyFormat.olFormatPlain;
                    }
                    foreach (string attachment in attachments)
                    {
                        int attachType = (int)OutlookApp.OlAttachmentType.olByValue;
                        int attachPosition = (int)message.Body.Length + 1;
                        String attachDisplay = "Allegato";
                        OutlookApp.Attachment attach = message.Attachments.Add(attachment, attachType, attachPosition, attachDisplay);
                    }
    
                    OutlookApp.Account ac = app.Session.Accounts[nomeAccount];
                    message.SendUsingAccount = ac;
    
                    message.Send();
    

    It works this way. There are obviously many disadvantages using Microsoft Office Automation on a server though...

    Friday, January 20, 2012 2:07 PM
  • yes, that is why i wanted to find out if outlook does translation (through some address list,etc.) or is it purely exchange stuff.
    Friday, January 20, 2012 2:11 PM
  • If Outlook shows the custom address type (FAX as iopposed to SMTP), the message (or rather fax) is sent through a custom transport provider installed in Outlook. Since it is installed in Outlook, you can only send through it if you are using the Outlook Object Model, Extended MAPI, or a library that wraps Extended MAPi (such as Redemption).
    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    • Marked as answer by ErionPC Friday, January 20, 2012 2:32 PM
    Friday, January 20, 2012 2:24 PM
  • That explains it.

    Thank you.

    Friday, January 20, 2012 2:33 PM