jetzig/demo/src/app/jobs/example.zig
Bob Farrell a5430ff380 Zig 0.14 test runner config changes
Update dependencies to match new Zig build config API for test runners,
misc. fixes needed after upgrading dependencies.
2025-02-02 11:31:40 +00:00

24 lines
812 B
Zig

const std = @import("std");
const jetzig = @import("jetzig");
/// The `run` function for all jobs receives an arena allocator, the params passed to the job
/// when it was created, and an environment which provides a logger, the current server
/// environment `{ development, production }`.
pub fn run(allocator: std.mem.Allocator, params: *jetzig.data.Value, env: jetzig.jobs.JobEnv) !void {
try env.logger.INFO("Job received params: {s}", .{try params.toJson()});
const mail = jetzig.mail.Mail.init(
allocator,
env,
.{
.subject = "Hello!!!",
.from = .{ .email = "bob@jetzig.dev" },
.to = &.{.{ .email = "bob@jetzig.dev" }},
.html = "<div>Hello!</div>",
.text = "Hello!",
},
);
try mail.deliver();
}