mirror of
				https://github.com/nitnelave/lldap.git
				synced 2023-04-12 14:25:13 +00:00 
			
		
		
		
	allow non authenticated smtp connections
This commit is contained in:
		
							parent
							
								
									98acd68f06
								
							
						
					
					
						commit
						2d8a2659c7
					
				@ -26,11 +26,7 @@ async fn send_email(to: Mailbox, subject: &str, body: String, options: &MailOpti
 | 
				
			|||||||
                .header(lettre::message::header::ContentType::TEXT_PLAIN)
 | 
					                .header(lettre::message::header::ContentType::TEXT_PLAIN)
 | 
				
			||||||
                .body(body),
 | 
					                .body(body),
 | 
				
			||||||
        )?;
 | 
					        )?;
 | 
				
			||||||
    let creds = Credentials::new(
 | 
					    let mut mailer = match options.smtp_encryption {
 | 
				
			||||||
        options.user.clone(),
 | 
					 | 
				
			||||||
        options.password.unsecure().to_string(),
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
    let mailer = match options.smtp_encryption {
 | 
					 | 
				
			||||||
        SmtpEncryption::NONE => {
 | 
					        SmtpEncryption::NONE => {
 | 
				
			||||||
            AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(&options.server)
 | 
					            AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(&options.server)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -39,12 +35,15 @@ async fn send_email(to: Mailbox, subject: &str, body: String, options: &MailOpti
 | 
				
			|||||||
            AsyncSmtpTransport::<Tokio1Executor>::starttls_relay(&options.server)?
 | 
					            AsyncSmtpTransport::<Tokio1Executor>::starttls_relay(&options.server)?
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    mailer
 | 
					    if options.user.as_str() != "" {
 | 
				
			||||||
        .credentials(creds)
 | 
					        let creds = Credentials::new(
 | 
				
			||||||
        .port(options.port)
 | 
					            options.user.clone(),
 | 
				
			||||||
        .build()
 | 
					            options.password.unsecure().to_string(),
 | 
				
			||||||
        .send(email)
 | 
					        );
 | 
				
			||||||
        .await?;
 | 
					        mailer = mailer.credentials(creds)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mailer.port(options.port).build().send(email).await?;
 | 
				
			||||||
    Ok(())
 | 
					    Ok(())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user