0 votes
by (200 points)
edited

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
by (147k points)
edited
 
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.

...