We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Credentials

Receiving an exception when trying to send mail via SmtpClient outside of my own network, is there a way to specify login credentials? Exception : Aspose.Network.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay for email@outsidenetwork.com

Actually think there is an issue with the server setup, but provided that is correct, I would just set the AuthenticationMethod of the SmtpClient to SmtpAuthentication.Login, correct? Then it will use the user/pass provided

Hi,

Thank you for inquiry.

To authenticate with the SMTP server, you can use the username and password in the constructor or properties. If authentication is done properly, then Aspose.Network’s SmtpClient class will hand over the email to the SMTP server. The relay problem for outbound addresses are most probably related to your SMTP relay services. Please try sending email with Outlook using the same SMTP server to the same recipient and see if you get the same relay error or not?

Yeah, it was a problem with the relay. Thanks for the response.

Hi,
I am having a similar problem. It used to work fine when connecting to Outlook 2003 server. However our tech team asked us to connect to Outlook 2010 server. Problem is it sends mails internally but doesnt seem to be using authentication. As a result, I cant recall the messages. Also, any email sent out side the firm is failing due to below error:

Aspose.Email.Mail.SmtpFailedRecipientsException: Unable to send to a recipient. ---> Aspose.Email.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay

--- End of inner exception stack trace ---

at Aspose.Email.Mail.SmtpClient.? [1](IEnumerator , ? )

at Aspose.Email.Mail.SmtpClient.Send(MailMessage message)



The code is below:

SmtpClient client = new SmtpClient(appContext._EmailServer, appContext._Port, appContext._EmailUser, appContext._EmailPassword);
client.Host = appContext._EmailServer;
//Specify your mail user name
client.Username = appContext._EmailUser;
//Specify your mail password
client.Password = appContext._EmailPassword;
client.AuthenticationMethod = SmtpAuthentication.Login;
//Specify your Port #
client.Port = appContext._Port;
client.Send(message);
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:DoNotOptimizeForBrowser/>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

I am using Aspose.Email: v2.0.50727 (version: 2.3.0.0)

It worked after our Outlook team changed a setting on the server. Please see comment below and advise if you support TLS and/or Integrated Windows Authentication

I disabled “offer Basic authentication only after starting TLS” option on Server Receive connector.

Please have the vendor check whether the application supports TLS and/or Integrated Windows authentication.

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi Jayesh,


Yes, TLS is supported. Also, NTLM (Authentication using DefaultCredentials) is also supported since Aspose.Email for .NET 3.2.0. Please try it at your end and let us know your feedback.

I got below error when using
the library<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

"The subscription included in this license allows free upgrades until 30 Dec 2012, but this version of the product was released on 11 Aug 2013. Please renew the subscription or use a previous version of the product"

We did have a subscription license. It looks like our subscription was to get updates only upto Dec 2012 :(.

We had purchased this library thinking we can use it reliably for our emails only to come to know now that it didn’t support TLM/NTLM in previous versions L

Hi Jayesh,


We are afraid for your license expiry to avail this feature. However, you may try it with a 30-day temporary license to see if it works for your and let us know your feedback.

What should I set SmtpClient.AuthenticationMethod? in the new library?

I am using the new library (3.2.1)
I am logged in as myself but using credentials of another user by setting the username, password and from email id.
I tried SmtpAuthentication.DigestMD5 and SmtpAuthentication.CramMD5

However I get the following error:Client does not have permissions to send as this senderPlease advise.


SmtpClient client = new SmtpClient(appContext._EmailServer, appContext._Port, appContext._EmailUser, appContext._EmailPassword);
client.Host = appContext._EmailServer;
client.Username = appContext._EmailUser;
client.Password = appContext._EmailPassword;
client.AuthenticationMethod = SmtpAuthentication.CramMD5;
client.Port = appContext._Port;
client.Send(message);I am using the new library (3.2.1)
I am logged in as myself but using credentials of another user by setting the username, password and from email id.
I tried SmtpAuthentication.DigestMD5 and SmtpAuthentication.CramMD5

However I get the following error:Client does not have permissions to send as this senderPlease advise.

I am using the new library (3.2.1)
I am logged in as myself but using credentials of another user by setting the username, password and from email id.
I tried SmtpAuthentication.DigestMD5 and SmtpAuthentication.CramMD5

However I get the following error:Client does not have permissions to send as this senderPlease advise.


SmtpClient client = new SmtpClient(appContext._EmailServer, appContext._Port, appContext._EmailUser, appContext._EmailPassword);
client.Host = appContext._EmailServer;
client.Username = appContext._EmailUser;
client.Password = appContext._EmailPassword;
client.AuthenticationMethod = SmtpAuthentication.CramMD5;
client.Port = appContext._Port;
client.Send(message);I am using the new library (3.2.1)
I am logged in as myself but using credentials of another user by setting the username, password and from email id.
I tried SmtpAuthentication.DigestMD5 and SmtpAuthentication.CramMD5

However I get the following error:Client does not have permissions to send as this senderPlease advise.

Hi Jayesh,


We are sorry for a delayed response.

From your earlier requirements, where you needed to send message using the logged in user, could you please leave the AuthenticationMethod to its default value and set SmtpClient.DefaultCredentials to true. This will allow you to send email using the credentials of the logged in user. Please let us know your feedback then.

I want to run as a different user and use credentials of different user but dont want to send password in plain text but send using TLS . Is it possible?

Hi Jayesh,

Could you please try setting the SmtpClient.EnableSSL flag and Smtp.SecurityMode, and see if that works for you as in article ? In case this doesn’t meet your requirements, I would request you to please create a new thread and share your exact requirements in it along with your network details. I will escalate the issue to the development team for their immediate opinion about it. We regret the inconvenience caused to you.