Working sender
This commit is contained in:
parent
190c62821f
commit
e2c34d68aa
3
.env
3
.env
@ -4,7 +4,7 @@ ACCOUNT_DATABASE_URL=postgres://postgres@localhost/bazzar_accounts
|
||||
CART_DATABASE_URL=postgres://postgres@localhost/bazzar_carts
|
||||
|
||||
PASS_SALT=18CHwV7eGFAea16z+qMKZg
|
||||
RUST_LOG=info
|
||||
RUST_LOG=debug
|
||||
SESSION_SECRET="NEPJs#8jjn8SK8GC7QEC^*P844UgsyEbQB8mRWXkT%3mPrwewZoc25MMby9H#R*w2KzaQgMkk#Pif$kxrLy*N5L!Ch%jxbWoa%gb"
|
||||
JWT_SECRET="42^iFq&ZnQbUf!hwGWXd&CpyY6QQyJmkPU%esFCvne5&Ejcb3nJ4&GyHZp!MArZLf^9*5c6!!VgM$iZ8T%d#&bWTi&xbZk2S@4RN"
|
||||
SIGNATURE=David
|
||||
@ -15,6 +15,7 @@ PGDATESTYLE=
|
||||
SENDGRID_SECRET=SG.CUWRM-eoQfGJNqSU2bbwkg.NW5aBy5vZueCSOwIIyWUBqq5USChGiwAFrWzreBKvOU
|
||||
SENDGRID_API_KEY=CUWRM-eoQfGJNqSU2bbwkg
|
||||
SMTP_FROM=adrian.wozniak@ita-prog.pl
|
||||
SD=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
|
||||
|
||||
PAYU_CLIENT_ID="145227"
|
||||
PAYU_CLIENT_SECRET="12f071174cb7eb79d4aac5bc2f07563f"
|
||||
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -3755,9 +3755,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "sendgrid"
|
||||
version = "0.17.4"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88afc7511b68247bf469e0dff55eb7ef305aab293211242695fd07cc17e36a78"
|
||||
checksum = "fd6ba8c048dc4beab827cebc1d54f1007f5ebdfa240812ed6faa89452fd34ba0"
|
||||
dependencies = [
|
||||
"data-encoding",
|
||||
"reqwest",
|
||||
|
@ -18,7 +18,7 @@ opentelemetry = { version = "0.17.0" }
|
||||
opentelemetry-jaeger = { version = "0.17.0" }
|
||||
pretty_env_logger = { version = "0.4", features = [] }
|
||||
rumqttc = { version = "*" }
|
||||
sendgrid = { version = "0.17", features = ["async"] }
|
||||
sendgrid = { version = "0.18.1", features = ["async"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = { version = "1.0", features = [] }
|
||||
tarpc = { version = "0.30.0", features = ["tokio1", "serde-transport-bincode", "serde-transport", "serde", "serde-transport-json", "tcp"] }
|
||||
@ -29,4 +29,4 @@ tracing-opentelemetry = { version = "0.17.4" }
|
||||
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
dotenv = { version = "0.15.0" }
|
||||
handlebars = { version = "*", features = [] }
|
||||
handlebars = { version = "*", features = [] }
|
||||
|
@ -15,11 +15,11 @@
|
||||
<h1 class="mb-3 text-xl font-semibold tracking-tight text-sky-600">Hi {{ login }}</h1>
|
||||
|
||||
<p class="mb-2 leading-normal text-sky-900">
|
||||
Welcome to {service_name} – we’re excited to have you on board, and we’d love to say thank you on behalf
|
||||
Welcome to {{ service_name }} – we’re excited to have you on board, and we’d love to say thank you on behalf
|
||||
of our whole company for choosing us.
|
||||
</p>
|
||||
<p class="mb-2 leading-normal text-sky-900">Take care,</p>
|
||||
<p class="mb-2 leading-normal text-sky-900">{signature}</p>
|
||||
<p class="mb-2 leading-normal text-sky-900">{{ signature }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -82,6 +82,7 @@ pub async fn welcome(msg: welcome::Input, ctx: SharedContext) -> Result<()> {
|
||||
Error::ResetPassTemplate
|
||||
})?;
|
||||
|
||||
tracing::info!("Sending to send mail {}", html);
|
||||
let smtp_from = ctx.config.lock().mail().smtp_from().clone();
|
||||
let status = ctx
|
||||
.send_grid
|
||||
@ -95,7 +96,11 @@ pub async fn welcome(msg: welcome::Input, ctx: SharedContext) -> Result<()> {
|
||||
)
|
||||
.await;
|
||||
|
||||
tracing::debug!("{:?}", status);
|
||||
tracing::info!("status {:?}", status);
|
||||
|
||||
if let Ok(res) = status {
|
||||
tracing::info!("res status {:?}", res.status());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ pub async fn start(config: SharedAppConfig, ctx: SharedContext) {
|
||||
|
||||
match notification {
|
||||
Ok(Event::Incoming(Incoming::Publish(publish))) => {
|
||||
tracing::info!("Received publish {:?}", publish.topic);
|
||||
tracing::info!("accounts received publish {:?}", publish.topic);
|
||||
match publish.topic.as_str() {
|
||||
t if AccountTopic::AccountCreated == t => {
|
||||
on_created(publish, ctx.clone()).await
|
||||
@ -66,7 +66,7 @@ pub async fn start(config: SharedAppConfig, ctx: SharedContext) {
|
||||
|
||||
match notification {
|
||||
Ok(Event::Incoming(Incoming::Publish(publish))) => {
|
||||
tracing::info!("Received publish {:?}", publish.topic);
|
||||
tracing::info!("emails received publish {:?}", publish.topic);
|
||||
match publish.topic.as_str() {
|
||||
t if EmailTopic::ResetPassword == t => {
|
||||
on_reset(publish, ctx.clone()).await
|
||||
@ -75,12 +75,12 @@ pub async fn start(config: SharedAppConfig, ctx: SharedContext) {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Ok(Event::Incoming(inc)) => {
|
||||
eprintln!("{:?}", inc);
|
||||
}
|
||||
Ok(Event::Outgoing(out)) => {
|
||||
eprintln!("{:?}", out);
|
||||
}
|
||||
// Ok(Event::Incoming(_inc)) => {
|
||||
// eprintln!("{:?}", inc);
|
||||
// }
|
||||
// Ok(Event::Outgoing(_out)) => {
|
||||
// eprintln!("{:?}", out);
|
||||
// }
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@ -119,12 +119,17 @@ async fn on_reset(publish: Publish, ctx: SharedContext) {
|
||||
}
|
||||
|
||||
async fn on_test(publish: Publish, ctx: SharedContext) {
|
||||
tracing::info!("Got test");
|
||||
if let Some(msg) = emails::Topic::Test.deserialize_payload::<model::Account>(publish.payload) {
|
||||
let msg = test_mail::Input {
|
||||
receiver: msg.email,
|
||||
};
|
||||
if let Err(e) = actions::test_mail(msg, ctx).await {
|
||||
tracing::error!("{}", e);
|
||||
} else {
|
||||
tracing::info!("Test mail done");
|
||||
}
|
||||
} else {
|
||||
tracing::warn!("Invalid payload");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user