views:

66

answers:

2

Hi, We have a exchangeserver configured to send the attachment of a email as fax if the the "to-address-field" is in the format [fax:user/company@faxnumber] (used internally). It works when I send manually from Outlook. But how can send an email with to-address as above using Smtpclient?

Is it possible to suppress the emailaddress validation? at the moment i get this error: "System.FormatException : The specified string is not in the form required for an e-mail address."

+1  A: 

I'm fairly sure that it's not possible. However, at least in .Net 4.0 (which is less restrictive than earlier versions), everything except the : is fine though. Maybe you could get the admins to change the SMTP server to support other characters than : after the string fax?

For example, maybe you could use fax= instead.

ho1
Yes, the usual format is something like "[email protected]"
Steven Sudit
ThorHalvor
@ThorHalvor: Are you using .Net 4.0? Remember that it's less restrictive than earlier version (though I've only tried to create a `MailMessage` with a `MailAddress` that contains a `=`, I've not tried to actually send it so it might fall over at a later stage).
ho1
Yes i use 4.0. And yes, it failes in an later stage given in stacktrace above. currently im trying withoug []brackets and = instead of :...
ThorHalvor
@ThorHalvor: Didn't realise that the brackets were part of the address. Without that it seems ok with the = in .Net 4.0 for me.
ho1
+1  A: 

It is not possible through the SmtpClient. If fax=asdfasdf is wanted then going through interop.outlook.dll is needed.

ThorHalvor