- Azure Serverless Computing Cookbook
- Praveen Kumar Sreeram
- 225字
- 2021-07-02 20:23:08
How to do it...
- Navigate to the RegisterUser function and make the following changes.
- Add a new string variable that accepts new input parameter named email from the request object:
string firstname= inputJson.firstname;
string lastname=inputJson.lastname;
string profilePicUrl = inputJson.ProfilePicUrl;
string email = inputJson.email;
UserProfile objUserProfile = new
UserProfile(firstname,lastname,profilePicUrl,email);
- Add the following code immediately after instantiating the message object:
message = new Mail();
message.Subject = "New User got registered
successfully.";
message.From = new Email("donotreply@example.com");
message.AddContent(new Content("text/html","Thank you so much
for getting registered to our site."));
Personalization personalization = new Personalization();
personalization.AddTo(new Email(email));
message.AddPersonalization(personalization);
....
....
....
public class UserProfile : TableEntity
{
public UserProfile(string lastName, string firstName,string
profilePicUrl,string email)
{
....
....
this.ProfilePicUrl = profilePicUrl;
this.Email = email;
}
....
....
public string ProfilePicUrl {get; set;}
public string Email { get; set; }
}
Instead of hardcoding, we are passing the values of the Subject, body (content), and From address dynamically via code. It's also possible to change the values and personalize based on the needs. Note that the email will be sent to the end user who got registered by providing an email address.
- Let's run a test by adding a new input field email to the test request payload, shown as follows:
{
"firstname": "Praveen",
"lastname": "Sreeram",
"email":"example@gmail.com",
"ProfilePicUrl":"A Valid url here"
}
- This is the screenshot of the email that I have received:

推薦閱讀
- C++面向對象程序設計(第三版)
- Java逍遙游記
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發(fā)經典名著)
- Node.js+Webpack開發(fā)實戰(zhàn)
- Apache Oozie Essentials
- Vue.js 2 and Bootstrap 4 Web Development
- AngularJS Web Application Development Blueprints
- OpenNI Cookbook
- Mastering Swift 2
- C++ 從入門到項目實踐(超值版)
- PHP+MySQL網站開發(fā)項目式教程
- C程序設計案例教程
- WebRTC技術詳解:從0到1構建多人視頻會議系統(tǒng)
- Java EE核心技術與應用
- Learning R for Geospatial Analysis