How to do email verification in ios?

0 votes

Hi, i want to send a verification link to user when the user register in the app. i successful to send email to user, but how to send verfication link to user?

i had create the email template with some text message, but when i send the email to user, the email shown is the message that i write in code but not the content that i set in template. Why? Does App42 got provide default email verification link that send to user and ask user to click on that link to verify?

 

    NSString *sendTo = @"testing@gmail.com";

    NSString *sendSubject  = @"Feedback";

    NSString *sendMsg = @"http://google.com";

    NSString *senderEmailId = @"admin@gmail.com";

    NSMutableDictionary *otherMetaHeaders = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Verification",@"Email", nil];

    EmailService *emailService = [App42API buildEmailService];

    [emailService setOtherMetaHeaders:otherMetaHeaders];

    [emailService sendMail:sendTo subject:sendSubject Message:sendMsg fromEmail:senderEmailId emailMIME:PLAIN_TEXT_MIME_TYPE completionBlock:^(BOOL success, id responseObj, App42Exception *exception)

    {

        if (success)

        {

            Email *email = (Email*)responseObj;

            NSLog(@"from is   %@" , email.from);

            NSLog(@"to is  %@" ,  email.to);

        }

        else

        {

            NSLog(@"Exception = %@",[exception reason]);

            NSLog(@"HTTP error Code = %d",[exception httpErrorCode]);

            NSLog(@"App Error Code = %d",[exception appErrorCode]);

            NSLog(@"User Info = %@",[exception userInfo]);  

        }  

    }];

asked Apr 25, 2016 in iOS by kmchai (10 points)
recategorized Apr 25, 2016 by shepAdmin

1 Answer

0 votes

H Kmchai,

You can achieve this by following the below steps:

  • Create one HTML page and host that page into our server using File Storage service ( How? Login to AppHQ console Storage > File > Upload File option. Select HTML type and upload it)
  • At the time of creating the User, send the above uploaded URL in email by appending user email id in query params (Email Verification URL)
  • In the Html file page, write the logic of getting query params from URL and save information in No-SQL Storage service that email verify is true (Using JavaScript SDK)

By following the above steps, you can easily validate that user has verified his/her email address or not. 

Also, at the time of login into App, you can check the above document into the collection. If a document exists in the database which has email verify true for that email id then allow the user to enter into the app else redirect into the verified process.

Let me know if it helps  or you need any help from my side.I will be happy to help you.

Regards,

Himanshu Sharma

 

 

answered Apr 25, 2016 by hs00105 (2,005 points)
Thank you for your answer. Can you guide me more detail on how to do the step 3: In the Html file page, write the logic of getting query params from URL and save information in No-SQL Storage service that email verify is true (Using JavaScript SDK).

My html file almost the same like = http://forum.shephertz.com/?qa=6983/how-to-do-email-verification&show=6983#q6983
but i did not receive any json in dashboard, the function like stop at App42.initialize.
 
Thank you very much.
Hi, i found the solution. Is my mistake, i forgot to put the sdk into the same folder. Thank you very much.
Great, let me know if you need any help from my side. I will be happy to help you.

Regards,
Himanshu Sharma
Hi, when i upload the html file to storage. The html file cannot find the app42 sdk, so the html file cannot send json to storage. Can you please help me on that? Thank you.
Hi,

You have to give the URL of App42 SDK in HTML file.
How you can do this? You can upload App42 JS SDK on CDN and give the CDN URL in HTML file and check. It will work for you. If you still have any concern then let me know.

Regards,
Himanshu Sharma
Thank you very much.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...