Browse Source
			
			
			Allow the smtp mechanism to be provided without quotes and all lowercase
			
			
				pull/906/head
			
			
		 
		
			
				
					
						 Daniel García
					
					6 years ago
						Daniel García
					
					6 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: FC8A7D14C3CD543A
						
					
				
			
		
		
		
	
		
			
				 1 changed files with 
5 additions and 
4 deletions
			 
			
		 
		
			
				- 
					
					
					 
					src/mail.rs
				
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -44,10 +44,11 @@ fn mailer() -> SmtpTransport { | 
			
		
	
		
		
			
				
					|  |  |         _ => smtp_client, |  |  |         _ => smtp_client, | 
			
		
	
		
		
			
				
					|  |  |     }; |  |  |     }; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     let smtp_client = match &CONFIG.smtp_auth_mechanism() { |  |  |     let smtp_client = match CONFIG.smtp_auth_mechanism() { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         Some(auth_mechanism_json) => { |  |  |         Some(mechanism) => { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             let auth_mechanism = serde_json::from_str::<SmtpAuthMechanism>(&auth_mechanism_json); |  |  |             let correct_mechanism = format!("\"{}\"", crate::util::upcase_first(&mechanism.trim_matches('"'))); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             match auth_mechanism { |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |             match serde_json::from_str::<SmtpAuthMechanism>(&correct_mechanism) { | 
			
		
	
		
		
			
				
					|  |  |                 Ok(auth_mechanism) => smtp_client.authentication_mechanism(auth_mechanism), |  |  |                 Ok(auth_mechanism) => smtp_client.authentication_mechanism(auth_mechanism), | 
			
		
	
		
		
			
				
					|  |  |                 _ => panic!("Failure to parse mechanism. Is it proper Json? Eg. `\"Plain\"` not `Plain`"), |  |  |                 _ => panic!("Failure to parse mechanism. Is it proper Json? Eg. `\"Plain\"` not `Plain`"), | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
	
		
		
			
				
					|  | 
 |