001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.verify2; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019 020/** 021 * Defines properties for sending a verification code to a user via e-mail. 022 * <p> 023 * Our email solution supports domain registration, if you plan to scale email verification to high 024 * volumes with Verify v2, please contact Sales in order to get your account configured properly. 025 */ 026public final class EmailWorkflow extends Workflow { 027 028 /** 029 * Constructs a new e-mail verification workflow. 030 * 031 * @param to The email address to send the verification request to. 032 */ 033 public EmailWorkflow(String to) { 034 this(to, null); 035 } 036 037 /** 038 * Constructs a new e-mail verification workflow with a custom sender address. 039 * 040 * @param to The email address to send the verification request to. 041 * 042 * @param from The e-mail address to send the verification request from. 043 * Note that you will need to get in touch with the Vonage sales team to enable use of the field. 044 */ 045 public EmailWorkflow(String to, String from) { 046 super(Channel.EMAIL, to, from); 047 } 048 049 /** 050 * The e-mail address to send the verification request from, if configured. 051 * 052 * @return The sender e-mail address, or {@code null} if unset. 053 */ 054 @JsonProperty("from") 055 public String getFrom() { 056 return from; 057 } 058 059 /** 060 * The email address to send the verification request to. 061 * 062 * @return The recipient's e-mail address. 063 */ 064 @Override 065 public String getTo() { 066 return super.getTo(); 067 } 068}