cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IzzyWizz
Helper III
Helper III

Send email to a recipient chosen in a Dropdown where the email address is held in a collection along with the recipient's name

Hi,

In the OnStart function of my Sign in Visitors app, I use Clear Collect to set up a table with Name and Email address, e.g.

ClearCollect(AuthorisationList,
     {Name:"A", Email:"xx"}, 
     {Name:"B", Email:"xx"}, 
     {Name:"C", Email:"xx"}
     )

I use this collection for the Items in a dropdown:

AuthorisationList.Name

 What I now want to do is send an email to the person who's name is chosen in the dropdown. But, I don't know how to pull the email address out of the collection when it is the Name that is chosen in the dropdown. I have tried the below but that doesn't work.

Set(
        varEmailSend,
        Office365Outlook.SendEmail(
            Dropdown1.Selected.Email,
            "Visitor Registration",
            "You have just authorised " && TextInputName.Text && " from " && TextInputComp.Text && " as a visitor."
        )
    
);

Can anyone help, please?

Thanks,

Izzy.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@IzzyWizz 

You are restricting the values in your dropdown to the Name only.

Consider the following changes:

On your Dropdown - set the Items property to : AuthorisationList  and then make sure the Value to display is set to Name (this is done easily in the property pane on the right of the designer).

Next, Set your other formula to the following:

Office365Outlook.SendEmailV2(
    Dropdown1.Selected.Email,
    "Visitor Registration",
    "You have just authorised " && TextInputName.Text && " from " && TextInputComp.Text && " as a visitor."
)

Note: SendEmailV2 should be used as SendEmail has been deprecated.  Also, the SendEmailV2 does not return anything, so setting it to a variable is of no value.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@IzzyWizz 

You are restricting the values in your dropdown to the Name only.

Consider the following changes:

On your Dropdown - set the Items property to : AuthorisationList  and then make sure the Value to display is set to Name (this is done easily in the property pane on the right of the designer).

Next, Set your other formula to the following:

Office365Outlook.SendEmailV2(
    Dropdown1.Selected.Email,
    "Visitor Registration",
    "You have just authorised " && TextInputName.Text && " from " && TextInputComp.Text && " as a visitor."
)

Note: SendEmailV2 should be used as SendEmail has been deprecated.  Also, the SendEmailV2 does not return anything, so setting it to a variable is of no value.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

JR-BejeweledOne
Super User
Super User

I would use a variable in the email formula.

 

Set your variable in the onChange formula of the dropdown.   Like this:

 

Set(varEmailAddress, Dropdown1.email)



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Hi,

Excellent, works perfectly, thanks.

Izzy.

RandyHayes
Super User III
Super User III

@JR-BejeweledOne 

There is no need for a variable...the information is already there.  It just needs to be referenced.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,034)