Table of Contents

Password and SMS

Strengthen a message's protection: require a password, an opening code sent through a second channel, or send the link by SMS.

Prerequisites

A send that already works: see Send a message.

Send modes

The send mode chooses the channel for the link and the one for the opening code. It applies to every recipient of the send.

Mode Link sent by Opening code sent by
onlyEmail (default) Email None
msgSMSOnly SMS None
msgSMSCodeEmail SMS Email
msgEmailCodeSms Email SMS

The password is independent of the mode: it combines with each of them.

Note

The send_method docstring says "1 = email+SMS". This is wrong: 1 is SMS_ONLY, the link by SMS without email. Rely on the table above.

Example

Link by email, opening code by SMS, and a password.

var recipients = new List<RecipientInfo>
{
    new RecipientInfo { Email = "recipient@example.com", Phone = "+15145550123" }
};

var args = new MutliRecipientArgs(
    endPointUri: endpoint, serial: serial, user: apiUser, psw: apiPassword,
    recipients: recipients, message: message, subject: subject,
    password: password,       // give it to the recipient through another channel
    filesList: null,
    sendMode: SendMethodEnum.msgEmailCodeSms,
    getBackHtml: false,
    showSubject: true, getNotify: true, cultureID: "en-CA",
    maximumOpenTime: 3, minutesExpiration: 1440);

var response = MessageHelper.MultiRecipientMessage(args);

Then check the status of the send and of each recipient: see Multiple recipients.

The password

Point Detail
Scope One password for every recipient of the send. For different passwords, make one send per recipient.
Delivery Give it to the recipient through another channel than the message (phone, in person). Anyone who gets the link and the password can open the message.
Choice Long and unique for each send. If your application generates it, use a cryptographic generator: RandomNumberGenerator in .NET, secrets in Python, random_bytes in PHP.
Source code Never write it in code or in a configuration file. Do not log it.

The phone number

Point Detail
Format International, with the country code: +15145550123. No spaces or dashes: the number is validated after cleanup, but transmitted as entered.
Validation In any mode other than onlyEmail, each recipient must have a number that can receive SMS, otherwise the send is refused (status 400). Validate it before sending with IsValidPhoneNumberAndCanReceiveSMS.
Email Required, except with msgSMSOnly.

Common errors

Symptom Likely cause Solution
Status 400 "Invalid phone number (or can't recieve SMS)" Number missing, without country code, or a landline Pass a mobile number in international format.
Status 400 "Invalid email" Address missing or malformed, in a mode other than msgSMSOnly Validate the address with IsValidEmailAddress.
.NET: msgEmailCodeSMS does not compile Case: the former guides wrote msgEmailCodeSMS or onlySMS Use the names from the send modes table.
The recipient cannot open the message Password not received or wrongly delivered Check the channel you used to give it.
Warning

Personal information. On error, the text returned by the SDK may contain the recipient's address or number. Do not log it as is: keep the status and the tracking number.

Next