web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help with sendning Ema...
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:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    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
  • SB-16101758-0 Profile Picture
    4 on at
    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
    153,034 Most Valuable Professional on at
    Rather than re-post - I have updated the original post - it works as expected in testing here.
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard