cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VikasNagaraj
Helper V
Helper V

Send email to combobox selected users

Hi,

Hope you guys are well.

I am building a visitor log app using powerapps, I have a combo box with all the users in my office. I want to send Email to the selected user saying there is a new visitor. but i have a error when i use this code.

Office365Outlook.SendEmailV2 failed: The method 'SendEmailV2' has an invalid value for parameter 'To'. 

My code is as follows,

UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});SubmitForm(Form1);NewForm(Form1);Navigate('Status Message');Office365Outlook.SendEmailV2(Concat(ComboBox2.SelectedItems, Mail, ";"),"New Visitor","Hi you have a new visitor",{From:"support@aqualogic-wc.com"}).

Please help.

Thank you.Email Error.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@VikasNagaraj There was an extra bracket. Try this,

Office365Outlook.SendEmailV2(Concat(ComboBox2.SelectedItems, Mail & ";"),"New Visitor","Hi you have a new visitor",{From:"support@aqualogic-wc.com"});
UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});
SubmitForm(Form1);
NewForm(Form1);
Navigate('Status Message')

 

View solution in original post

26 REPLIES 26
CNT
Super User
Super User

@VikasNagaraj 

Please try the following,

UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});SubmitForm(Form1);NewForm(Form1);
Office365Outlook.SendEmailV2(Concat(ComboBox2.SelectedItems, Mail & ";"),"New Visitor","Hi you have a new visitor",{From:"support@aqualogic-wc.com"});
Navigate('Status Message');
VikasNagaraj
Helper V
Helper V

Hi @CNT,

Thanks for the quick reply, I am still getting the same error 😞 please find the attached image for reference.Error again.PNG

@VikasNagaraj Place Concat(ComboBox2.SelectedItems, Mail & ";") in the Text property of a Label and send me a screen shot of the result.

 

@CNT It is pulling up the email address correctly. Please find the attached image.Txt property.PNG

@VikasNagaraj Can't see any issues there. Try hardcoding that email and see if it works.

@CNT There are around 45 employees in that list, so i should hardcode their email into the combobox ? Please correct me if i am wrong.

@VikasNagaraj Nope! Just try with 2 or 3. Try the ones with special characters like -

Special character can create issues at times.

@CNT

I used the below code and used my Email ID, It worked fine, I received email.

UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});SubmitForm(Form1);NewForm(Form1);
Office365Outlook.SendEmailV2("vikasn@aqualogic-wc.com","New Visitor","Hi you have a new visitor",{From:"support@aqualogic-wc.com"});
Navigate('Status Message');

Dont know why it isn't working for combobox though 😞

@VikasNagaraj That's strange. Try this though,

UpdateContext({timestamp: Text(Now(),"yyyy-mm-dd hh:mm:ss.sss")});SubmitForm(Form1);NewForm(Form1);
With({varTo:Concat(ComboBox2.SelectedItems, Mail & ";")},
	Office365Outlook.SendEmailV2(varTo,"New Visitor","Hi you have a new visitor",{From:"support@aqualogic-wc.com"});
)
Navigate('Status Message');

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,197)