Rebex Mail settings from web.config?

0 votes
asked Jan 6, 2011 by Christina 1 (200 points)
edited Apr 1, 2011

Hi, Is there a way to get Rebex mail to use the smtp settings from the web.config file in the same way as the standard smtpclient does?

I know we need to set the All the examples we've found show the details hardcoded in, or reading the config directly.

Thanks, Christina

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Jan 7, 2011 by Lukas Pokorny (102,170 points)
edited Jan 7, 2011
 
Best answer

Yes, this is possible. Many static methods of Rebex Smtp object accept an instance of SmtpConfiguration class as one of its arguments. If you pass SmtpConfiguration.Default to it, SMTP settings from Web.config will be used:

Smtp.Send(message, SmtpConfiguration.Default);

You can also use SmtpConfiguration.Default to read the SMTP settings from Web.config and supply the values to non-static methods of Smtp object if preferred.

...