Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Help with sendning Email With or Without Picture's

(1) ShareShare
ReportReport
Posted on by 4

Hello

So this code work's fine for me, BUT i want to be able to send the email with or without pictures

i get error if there is no photo's added. please help.. this is my code, the PDF container works fine.

i can put the pictures in a attachments but that dident help me, pretty new at this..

Office365Outlook.SendEmailV2(

Dropdown2_5.SelectedText.Value,

Subject_2.Text,

"Se bifogad fil.",

{

Cc: "TEST@Email.com",

Attachments: Table(

{

Name: "Inventering.pdf",

ContentBytes: PDF(

Container1_1,

{

Orientation: PaperOrientation.Landscape,

Size: PaperSize.A4,

Margin: "24pt 24pt 24pt 24pt"

}

)

},

{ Name: "Bild1.png",

// Name of the first image attachment

ContentBytes: Image9.Image// Content of the first image attachment

},

{

Name: "Bild2.png",

// Name of the second image attachment

ContentBytes: Image9_1.Image// Content of the second image attachment

}

)

}

);

Categories:
  • WarrenBelz Profile Picture
    146,635 Most Valuable Professional on at
    Help with sendning Email With or Without Picture's
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    146,635 Most Valuable Professional on at
    Help with sendning Email With or Without Picture's
    Rather than re-post - I have updated the original post - it works as expected in testing here.
  • SB-16101758-0 Profile Picture
    4 on at
    Help with sendning Email With or Without Picture's
    Hello. 
     
    thx for the respons, problem is that i don’t get it to work.. so if u can explain more details about how I get this code to work I would be great full 
  • WarrenBelz Profile Picture
    146,635 Most Valuable Professional on at
    Help with sendning Email With or Without Picture's
    You would use a condition (probably a Variable) to conditionally attached the pictures.
    With(
       {
          _PDF: Table(
             {
                Name: "Inventering.pdf",
                ContentBytes: PDF(
                   Container1_1,
                   {
                      Orientation: PaperOrientation.Landscape,
                      Size: PaperSize.A4,
                      Margin: "24pt 24pt 24pt 24pt"
                   }
                )
             }
          ),
          _Image1: Table(
             {
                Name: "Bild1.png",
                ContentBytes: Image9.Image
             }
          ),
          _Image2: Table(
             {
                Name: "Bild2.png",
                ContentBytes: Image9_1.Image
             }
          )
       },
       Office365Outlook.SendEmailV2(
          Dropdown2_5.SelectedText.Value,
          Subject_2.Text,
          "Se bifogad fil.",
          {
             Cc: "TEST@Email.com",
             Attachments: Table(
                _PDF,
                If(
                   YourCondition1Here,
                   _Image1
                ),
                If(
                   YourCondition2Here,
                   _Image2
                )
             )
          }
       )
    );
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,635 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard