Browse Source
			
			
			Add option to use wrapped TLS in email, instead of STARTTLS upgrade
			
			
				pull/437/head
			
			
		 
		
			
				
					
						
						Daniel García
					
					7 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: FC8A7D14C3CD543A
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
10 additions and 
2 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/config.rs
				
 
			
				- 
					
					
					 
					src/mail.rs
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -303,8 +303,10 @@ make_config! { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        smtp_host:              String, true,   option; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// Enable SSL
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        smtp_ssl:               bool,   true,   def,     true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// Use explicit TLS |> Enabling this would force the use of an explicit TLS connection, instead of upgrading an insecure one with STARTTLS
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        smtp_explicit_tls:      bool,   true,   def,     false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// Port
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        smtp_port:              u16,    true,   auto,    |c| if c.smtp_ssl {587} else {25}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        smtp_port:              u16,    true,   auto,    |c| if c.smtp_explicit_tls {465} else if c.smtp_ssl {587} else {25}; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// From Address
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        smtp_from:              String, true,   def,     String::new(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        /// From Name
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -18,7 +18,13 @@ fn mailer() -> SmtpTransport { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            .build() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            .unwrap(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ClientSecurity::Required(ClientTlsParameters::new(host.clone(), tls)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        let params = ClientTlsParameters::new(host.clone(), tls); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if CONFIG.smtp_explicit_tls() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ClientSecurity::Wrapper(params) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ClientSecurity::Required(params) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ClientSecurity::None | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    }; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |