sendEmail
Reference
---@param fromAddress string -- Sender address (can be any string, e.g. "[email protected]")
---@param toAddress string -- Recipient's registered email address
---@param subject string -- Email subject line
---@param body? string -- Email body (supports HTML)
---@return boolean success
---@return string? error
function sendEmail(fromAddress, toAddress, subject, body) end The recipient must have a registered email account with the given toAddress. If the recipient is online, they will receive a laptop notification immediately.
The fromAddress does not need to be a registered account. It can be any string (e.g. [email protected], [email protected]).
Usage example
-- Send a simple notification email
local success, err = exports.fd_laptop:sendEmail(
'[email protected]',
'[email protected]',
'Warrant Notice',
'<p>You have an active warrant. Please report to the nearest station.</p>'
)
if not success then
print('Failed to send email:', err)
end -- Send from a player event
RegisterNetEvent('myresource:sendInvoice', function(targetEmail, amount)
local src = source
exports.fd_laptop:sendEmail(
'[email protected]',
targetEmail,
'Invoice #' .. math.random(1000, 9999),
('<p>You have been billed <strong>$%s</strong>.</p>'):format(amount)
)
end)