Powershell - Send-MailMessage - hide attachment

Posted on 2011-05-13
Last Modified: 2012-05-11

Pls would you advice? Is it possible to hide attached file(*.xlsx)?

Send-MailMessage -From "xx" -To "yyy" -Smtpserver "server" -Subject "REPORT: " -BodyAsHtml  -Body $Body -Attachments "C:\b\x.csv","C:\b\y.csv"  -Credential $mycreds

Open in new window

I mean that if somebody gets that email this attachment wont be visible.

Many thanks
Question by:Radim88
    LVL 70

    Accepted Solution

    Whatever happens to attachments is down to the mail client, and even then, hiding something other than images in-line will be very challenging / perhaps not possible.

    Images are done using System.Net.MailMessage (I'm afraid Send-MailMessage won't help you, you have to go down into .NET). This example is in C#, but there's little practical difference:


    I don't mind helping you convert the code, but I'm not convinced they'll do what you want them to.


    Author Comment

    Pls if you can do that.

    Author Closing Comment


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Set OWA language and time zone in Exchange for individuals, all users or per database.
    "Migrate" an SMTP relay receive connector to a new server using info from an old server.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now