Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Default with SSL #16

Closed
luizbon opened this issue Nov 21, 2011 · 5 comments
Closed

Using Default with SSL #16

luizbon opened this issue Nov 21, 2011 · 5 comments

Comments

@luizbon
Copy link

luizbon commented Nov 21, 2011

When using the default email configuration from web.config, the ssl setting is getting overrided on sending.
It should have an flag that we are using the default configuration and do not override the ssl configuration.

@lukencode
Copy link
Owner

Unfortunately you cannot use the web.config to set SSL it has to be managed by hand. Fluent email has a method called UseSSL that turns it on.

eg.

var email = Email
        .From("john@email.com")
        .To("bob@email.com", "bob")
        .UseSSL()
        .Subject("hows it going bob")
        .Body("yo dawg, sup?");

@luizbon
Copy link
Author

luizbon commented Nov 22, 2011

Luke, I have tested this and if I put on my web.config that it uses ssl, when it creates the client, the ssl option is marked as true, and the code in Send set it to false, since I don't used the fluent method with it.

My code its like this:

var email = Email
                  .FromDefault()
                  .To("bob@email.com", "bob")
                  .Subject("hows it going bob")
                  .Body("yo dawg, sup?");
And in my web.config I have something like this:
  <system.net>
    <mailSettings>
      <smtp from="john@email.com">
        <network enableSsl="true" host="smtp.email.com" defaultCredentials="true"/>
      </smtp>
    </mailSettings>
  </system.net>
  When I hit the Send Method, my _client object already has the EnableSsl property set to true, and since I don't used the FluentSyntax it sets to false.
  If the Method UseSSL simply set the Property on the _client object when its called, this will not happen.

@lukencode
Copy link
Owner

I will have to test the web.config thing because as far as I am aware the smpt client does not use the enableSsl attribute in the web config (http://stackoverflow.com/questions/454277/how-to-enable-ssl-for-smtpclient-in-web-config).

I do see what you are saying though so we might make the private _useSsl field nullable then only set the smtp client to use or not use ssl if it has been set.

@luizbon
Copy link
Author

luizbon commented Nov 22, 2011

Luke it has a comment in the first response that says tha in .Net 4 my configuration works, and I have tested too. Since Fluent Email is using Razor templates you can presume that this configuration is valid.

@lukencode
Copy link
Owner

Ah of course. Will fix up the code soon.

dkarzon pushed a commit to dkarzon/FluentEmail that referenced this issue Mar 31, 2012
jbennie pushed a commit to jbennie/FluentEmail that referenced this issue Jun 5, 2024
* Added simplified configuration for embedded templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants