title: lettre images in vec implement in singlepart
body: <p>Hello i am using Rust with crate lettre 0.10.0-rc-4.</p>
  <p>I found an answer on Github, but could not really implement it.
  I want to loop over a vec of images and add it to lettre email body sender.
  Here is the Code with the Vec:</p>
  <pre><code>  fn add_attachment(image_body: Vec&lt;calc_price::products::Products&gt;) -&gt; Vec&lt;lettre::message::SinglePart&gt; {
      let mut res: Vec&lt;lettre::message::MultiPart&gt;;
      image_body.iter().enumerate().map( |(i, product)| {
      //   product.crop.leftDistanceToCutLine.iter().enumerate().map( |(ind, left)| {
        let content_id = String::from(&quot;&quot;) + &amp;0.to_string() + &amp;&quot;-&quot; + &amp;0.to_string() + &amp;&quot;-&quot; + &amp;image_body[0].picture.name;
        let filebody = fs::read(&quot;src/images/&quot;.to_string() + &amp;image_body[0].picture.name+ &amp;&quot;.&quot; + &amp;&quot;jpeg&quot;).unwrap();
        let content_type = &quot;image/jpeg&quot;.parse().unwrap(); 
        Attachment::new_inline(content_id).body(filebody, content_type) // return attachment
        //   })
      })
      .collect::&lt;Vec&lt;lettre::message::SinglePart&gt;&gt;()
    }
  </code></pre>
  <p>But the singlepart of lettre does not accept Vec.
  Is there a workaround to it?</p>
  <pre><code>.singlepart(                  
    add_attachment(email_order.body.products.clone())
    )
  </code></pre>
  <p>With error expected struct <code>lettre::message::SinglePart</code>, found struct <code>std::vec::Vec</code></p>
  <p>The answer i found is on: <a href="https://github.com/lettre/lettre/issues/611#issuecomment-902391719" rel="nofollow noreferrer">github</a></p>