Send an email to multiple recipients.
How to embed QR-code pictures into html body ("QrCodes" array):
Set "EmbedQrCodes" value to true if you want to embed QR-code pictures into html rather then sending them as attachments.
Pictures will be embedded into html using pattern '<div id="qrcode<arrayIndex>"><img src="cid:<"QrCodePicture">"></div>' which will pe appended to the end of "MailBody" (in respect of the order they appear in "QrCodes" array)
For example, embedding of the first qr-code picture from "QrCodes" array would look like:
<div id="qrcode0"><img src="cid:example.png"></div>
You can also css-style that div using its id inside of your html message body.
- Parameters:
-
pParams | (params) Input parameters container:
- "MailRecipients" - Email addresses of recipients (paramArray of paramString), mandatory
- "MailSubject" - Email subject string (paramString), optional
- "MailBody" - Email body string (paramString), optional
- "MailBodyType" - Email body string (paramString), optional. Set this parameter to "html" if "MailBody" contain a UTF-8 encoded HTML message body.
- "EmbedQrCodes" - Embed QR-code pictures into html body (paramBool), optional, default false. Set this value to true if you want to embed QR-code pictures into html rather then sending them as attachments.
- "QrCodes" - QR-code pictures array (paramArray of paramParams), optional
-- "QrCodePicture" - QR-code pictures array item: image file contents encoded to base64 (single-byte characters in a paramBinary value or a wide-char paramString), optional but mandatory if "QrCodes" is set.
-- "QrCodePictureName" - QR-code pictures array item: name of the image file as an attachment (paramString), optional but mandatory if "QrCodes" is set.
|
wstrRequestId | Async request id. |
- Exceptions:
-
Throws | KLERR::Error* in case of error. |
See also Python code with use of KlAkOAPI Python package below:
server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False)
oOptions = KlAkOAPI.Params.KlAkParams({"MailRecipients": ["test@test.com"], "MailSubject": "Test qr-code email message", "MailBodyType": "html"})
oQrCode = KlAkOAPI.Params.KlAkParams({})
# base64 encoded png picture
oQrCode.AddBinary("QrCodePicture", b"iVBORw0KGgoAAAANSUhEUgAAAMgAAADIAQMAAACXljzdAAAABlBMVEX///8AAABVwtN+AAABLElEQVRYw+2XvRHDIAyFxaWg9AiM4s0csplHYQSXFBzKk0ic/zZSYZ0p4Gt0D54kEx1xxH+DJVaswIWibLob0rCmlWjuEaRgt/ghE7dpPW2zZl3OXLwRmjjU1L0S/pm1HdHb3hX9eAeWZLgEiUPO5Yt/LMmNb8T1e40xJLzN6hL6cLA9aZoyYGC+1ARFsyMywyKSNckxdF08ERyLV6K8wfDcMawJ7AuXnBiKikvy47Y9E1QcfCTeHkKn7IZIQWR5B9A6S71+1tqYIOV205WHvRc/hLXPYXZR//S4e9ue7J2YKHV6uW1zMvocbpvFJeVc33qwJXnMB3Vk7YnoXNV05tN6nbozMuYDFL/gj8AlOLvIuMyOyL20QMsc2RXZ/xulXUQo+uYfS3LEEfZxBUOv1KUQvtGnAAAAAElFTkSuQmCC")
oQrCode.AddString("QrCodePictureName", "testpic.png")
oOptions.AddString("MailBody", "<h2>Unordered List with Default Bullets</h2><ul><li>Entry 1</li><li>Entry 2</li><li>Entry 3</li></ul>")
oOptions.AddArray("QrCodes", [KlAkOAPI.Params.paramParams(oQrCode)])
KlAkOAPI.IWebUsersSrv.KlAkIWebUsersSrv(server).SendEmail(oOptions, str(uuid.uuid4()))