Get-childItem issue when sending mail

I'm having a problem where the below command works but not the way it should. For example, if i have two files it will display both files in the email instead of just one. 
$fname=Get-ChildItem \\Main\Drop| Where-Object {!$_.PSIsContainer}
and here is the body of the email
$Body = "Check Drop Folder for new file: `n $fname `n`nOR `nclick here: \\Main\Drop\$fname"
If i have 2 files in that drop directory say: file1.txt, file2.txt the email will say:
Check Drop Folder for new file:
file1.txt file2.txt
OR
click here: \\main\Drop\file1.txt file2.txt
I know its a simple fix but im missing it..

The idea here is to get only ONE email PER FILE, i do not want to combine the files in one email. So for two files, i will have two emails. 
Okay, here's a start:
Get-ChildItem \\Main\Drop | ForEach {
$body = "Check the drop folder for $($_.Name)"
Send-MailMessage -To [email protected] -From [email protected] -Subject $body -Body $body -SmtpServer smtp.domain.com
Don't retire TechNet! -
(Don't give up yet - 12,575+ strong and growing)

Similar Messages

  • Issues when sending mail from sap to outlook in .csv FORMAT

    hI all,
    Im using 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    FM TO send a mail from SAP to user with attachment in .csv format but the data isnot getting displayed correctly ...
    I thnk it is competely displayed in ASCII format ..
    Can anybody give me suggestionson the same
    thanks

    Hi.
    How is the user opening the .csv attachment?
    I'm guessing that it should be opened with Excel.
    Are you using an attachment document type of 'XLS'?
    If not, then the attachment won't be opened with Excel unless the user right-clicks on it and does 'Open with'.
    Even then, the user will have to use the Excel import wizard.
    Is a .csv file what you want?
    You can use the ABAP OLE stuff to write a native Excel file that can be attached to an email.
    Or you can (at the cost of more work) write the Excel file (still type XLS) using XML, which gives you more control, and still works when your program is run in the background.
    John

  • After updating to Mavericks MAIL no longer issues a "whoosh" sound when sending mail.  Can I get it back?

    After updating to Mavericks MAIL no longer issues a "whoosh" sound when sending mail.  Can I get it back?

    If restarting did not resolve the issue, open Mail Preferences and make sure the box next to "Play sounds for other mail actions" is checked.

  • TS3274 I have all sounds turned on in settings and the volume is up but I get no click when typing, no swoosh when sending mail, etc.

    Help. My sounds are turned on and volume is up but I get no keyboard click while typing and no swoosh when sending mail.

    1. Double-click the Home button and swipe the Task Bar (at bottom) to the right. Check volume and mute settings.
    2. Try a reset. Hold the Sleep and Home button down for about 10 seconds until you see the Apple Logo

  • Java.lang.NumberFormatException when sending mails

    Gurus,
    I am using java mail 1.4 to send mails from my application and the code to do so is
        public void postMail(String recipient, String message) {
            logger.fine("in postMail method..");
            boolean debug = true;
            Properties props = new Properties();
            props.put("mail.transport.protocol", "smtp");
            props.put("mail.smtp.host", ConfigProperty.getProperty("mail.smtp.host"));
            props.put("mail.smtp.auth","true");
            props.put("mail.smtp.port", ConfigProperty.getProperty("mail.smtp.port"));
            props.put("mail.smtp.from", ConfigProperty.getProperty("mail.from"));
            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(debug);
            Message msg = new MimeMessage(session);
            try {
                String from = ConfigProperty.getProperty("mail.from").trim();
                InternetAddress addressFrom = new InternetAddress(from);
                msg.setFrom(addressFrom);
                InternetAddress addressTo = new InternetAddress(recipient);
                msg.addRecipient(Message.RecipientType.TO, addressTo);
                msg.setSubject(ConfigProperty.getProperty("mail.subject"));
                msg.setContent(message, "text/plain");
                logger.info("Sending mail now...............................");
                Transport trans = session.getTransport("smtp");
                trans.connect("casarray.arg.ae",username,password);
                trans.send(msg);
            } catch (Exception e) {
                e.printStackTrace();
        }However i am getting the strange error when sending mails. My email is is very simple [email protected]
    Please help me understand the issue here
    java.lang.NumberFormatException: For input string: ""
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
         at java.lang.Integer.parseInt(Integer.java:470)
         at java.lang.Integer.parseInt(Integer.java:499)
         at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
         at javax.mail.Service.connect(Service.java:288)
         at javax.mail.Service.connect(Service.java:169)
         at com.roadMiles.view.util.EmailNotification.postMail(EmailNotification.java:54)
         at com.roadMiles.view.unsecure.page.bean.LoginPageBean.forgotPassword(LoginPageBean.java:180)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
         at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
         at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:788)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:306)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

    The error message is telling you exactly what's wrong:
    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:470)
    at java.lang.Integer.parseInt(Integer.java:499)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:398)
    at javax.mail.Service.connect(Service.java:288)
    at javax.mail.Service.connect(Service.java:169)
    at com.roadMiles.view.util.EmailNotification.postMail(EmailNotification.java:54)At line 54 of EmailNotification.java (which I assume is your class), you're calling connect(), but that fails, because, deeper down, it's trying to parse the empty String ("") as a number. So don't pass the empty String to connect(); pass a valid number instead.

  • Textarea problem when sending mail (only Firefox)

    When sending mail using textarea item with multiple lines, carriage returns are taken away in resulting mail when sent in Firefox, but not in IE.
    To send mail, I call Javascript function that gets textarea value ($v or $x.innerHTML give the same result) and calls then on-demand process that calls in turn APEX_MAIL function.
    Igor

    Thank you, Jari!
    "pre" did the trick. Line breaks are OK now.
    There is one small inconvenience, though: font becomes Courrier instead of sans-serif type. But this is less disturbing than missing line breaks.
    Igor

  • I keep getting a message "cannot send mail" a copy has been placed in your outbox. The recipient was rejected by the server because it does not allow relaying

    I keep getting a message "cannot send mail" a copy has been placed in your outbox. The recipient was rejected by the server because it does not allow relaying. How can I fix this error so I can send emails.

    The issue definitely sounds like your Outgoing/SMTP settings need to be changed.  Simply set them to the proper settings for your provider as was suggested above.
    I found this link for Knology:  http://support.knology.net/content/email.setup.cfm
    The SMTP settings can be edited on the iPad/iPhone by going to Settings--> Mail, Contacts, Calendars, edit the account having trouble, click the Account, then at the bottom is the SMTP server info, click on it to edit it further.
    It should allow you to edit the primary smtp server and let you enter all the good stuff as you see in the Knology link above.
    Some providers require you to register your account on their service like AT&T.

  • I want to bcc myself when sending mail from one account but not another. When I check "automatically bcc myself", it bcc's me from both accounts.  Can I set this to work with only one account?

    I have two mail accounts on my Mac.  I want one account to bcc me when I send emails from that account.  I checked "automatically bcc myself" under mail>preferences>composing, but both accounts bcc me when sending mail.  Can I set this to only bcc myself from one specific email account? Thanks.

    It does not make sense that your ssh does not have a dash capital Y (-Y) option. It is in "man ssh", and my 10.6.6 has the -Y option, and I've had a -Y option since at least Tiger (10.4) days.
    My ssh is in /usr/bin/ssh
    I'm not very good at X11 issues, so I'm just throwing ideas out there.
    Does your broken account have a $HOME/.ssh/config file, and if so, what is in it?
    Does the broken account have any $HOME/.x* or $HOME/.X* files that X11 might be reading to configure your X11 behavior differently from the new test account?
    $HOME/.Xauthority
    $HOME/.Xdefaults-<hostname>
    $HOME/.Xresources
    $HOME/.ICEauthority
    $HOME/.keymap.km
    The above are a few names I found looking through "man X"
    While I'm thinking about it, I assume that when going to the server, you are using the exact same user account on the server, so that you have a constant at least at that end.
    Have you tried trashing your
    $HOME/Library/Preferences/org.x.X11.plist
    file, to see if that is affecting the broken account?
    Again, I am just throwing out ideas to see if anything sticks.

  • Error PDF when sending mail

    Dear all,
    i'm facing a PDF error when sending mail, i figure that PDF attachment can't be more than 100 pages. is that correct?
    below is the error message when open ADOBE, this won't happen when pages in adobe less than 100.
    "Adobe Reader could not open 'NAME.PDF' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded) "
    can anyone help me please.

    Dear Experts
    I already configured application server configuration file with specifying SMTP mail server IP in pluginParam parameter
    <pluginParam name="mailServer">202.157.161.76</pluginParam>
    <property name="enableSSL" value="no"/>
    <property name="mailUserName" value="%[email protected]%"/>
    <property name="mailPassword" value="%soyacl#123%"/>
    what is the issue
    Pl clarify
    Please reply it's urgent

  • Spinning wheel not showing when sending mail

    Hello,
    I recently gave my older iMac G5/2GHz to my Mom and got her all set up - I transferred all of her documents and photos from her old original iMac G3/350 to the "new" iMac G5/2GHz. The iMac G5/2GHz has a very clean and up-to-date Mac OS X 10.4.11 on it. I used the iMac G5/2GHz right up until I got my new iMac 3.06 GHz Intel Core 2 Duo a few weeks ago.
    I deleted all the prefs files and related files and folders from Mail 2.1.3 and started off with a "fresh" copy of Mail 2.1.3. I then imported all her e-mail messages, folders and addresses from her old version of Outlook Express 5.0.6. I had a few problems with the import but I got it all straightened around (she had a few mail folders named with either a colon ":" or a slash "/" in them so I got that straightened out and everything worked fine afterward).
    But there's a strange problem happening with Mail 2.1.3 when she sends e-mails now. I am used to seeing the little "spinning wheel" to the right of the "Sent" mailbox when sending an e-mail to someone and the word "Sent" actually always seemed to change to "Sending" while mail was being sent but it doesn't do that anymore. The only way we can tell what's happening when sending e-mail is to open the Activity window from Mail's "Window" menu.
    Has anyone else encountered this problem and is there any way you may know of to fix it so that we can see the "progress" (the "spinning wheel") of the mail being sent to the right of the "Sent" mailbox (without having to use the "Activity" window)?
    All of her messages send and receive no problem but I can't, for the life of me, figure out why we can't see the progress of mail being sent out (we can see the progress spinning to the right of the Inbox when checking mail but nothing shows up when sending mail).
    Thanks in advance for your help.
    Gerard

    Hi Gerard,
    Yes it can, first I'd try this...
    Right click on that Mail folder, choose archive, you'll get everything in the folder, and the folder itself in a file called Mail.zip, move it to a safe place, same for the Mail Downloads folder... only the plist is separate.
    /Users/YourUserName/Library/Preferences/com.apple.mail.plist
    (Deleting may or may not require you to setup your account(s) again.)
    Quit Mail, then In your home folder, try moving this +folder & file+ to the Desktop then reboot...
    First, Safe Boot from the HD, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, then move these +folder & file+ to the Desktop.
    Move this Folder to the Desktop...
    /Users/YourUserName/Library/Caches/Mail/
    Move this file to the Desktop...
    /Users/YourUserName/Library/Mail/Envelope Index
    Reboot.

  • "smtp error" in webmail when sending mails

    Hello,
    "smtp error" in webmail when sending mails
    why?

    With the very little data offered, I can only give a general idea.
    "smtp error" usually means that webmail isn't pointed to a smtp server for sending out mails.
    Webmail normally (by default) points to the same box it's on for sending mails out. You can change the host and port with configutil.
    Some versions of webmail must point to iMS, and other mail servers won't work. Since I have no idea what version you have, I can't tell if this is a problem.
    Did it ever work?
    What version are you using?

  • Dtmail on x86 crashes when sending mail

    Hi,
    I'm running Solaris 10 on x86 and I'm wondering if there is a fix or a workaround
    for dtmail crashing when sending mail. There is an existing bug report for this
    filed July 20 2006 (6346618) but I'm unable to view the bug detail since I have
    not yet fully decided on a service plan. I've searched around Sunsolve and
    google but nothing is coming up. I tried build 45 of Solaris Express and the
    same problem is present. Does anyone have any additional information
    about this? Is a fix available for serivce plan holders?
    Thanks,
    Pat

    Thank you for looking at the bug. I do have 121488-01 installed; patch dated 12/19/2005. If a fix for this is rolled up into another patch, so far it is not available to me. As of this morning, there are no updates; dtmail still crashes on sending mail.
    Searching sunsolve for this returns three bug numbers:
    6346618 (dated July 20, 2006)
    5091421 (dated November 4, 2005)
    1187150 (dated November 16, 1995)
    although the 1995 bug is probably unrelated. Looks like my best chance at working around this may be to grab the dtmail binary from Solaris 9. Thanks to all who have looked at this with me so far; I appreciate it.
    Regards
    Pat

  • Out of office message when sending mail to Lotus Notes from SAP

    Hi,
    Is it possible to have an 'out of office' message when sending mail to Lotus Notes from SAP?
    I'm sending account statements by mail via a modified version of function FI_OPT_ARCHIVE_CORRESPONDENCE. The SAP username is send as a parameter, and later converted to the e-mail saved in the user profile. This works, - but I would like to have an out of office reply if the user I send to is out of office.
    Hope someone can help...
    Regards,
    Lene

    As Thomas pointed out, you can use regular SMTP mail to send the contents to Lotus Notes. You can use the function module SO_OBJECT_SEND or any of the SAP Office function modules to do this.
    Only thing to remember is that the SMTP may have been disabled by your basis team due to security risks involved. An alternative could be a lotus notes connector available from IBM.
    Srinivas

  • When sending mail to a recipent with "unrouteable adress" I get a popupwarning. Is it possible to disable this popup?

    I am trying to disable a popup alert I get when I send a message to a recipient with an error.
    I get the message "Unrouteable adress" as a popup and have to press OK to continue to send mails. The reason I want to disable this is that we are using thunderbird to send out newsletter, and have to press OK on all adresses that is wrong.

    Another option is to make an Automator workflow that creates a new email message formatted as you like. Here are the steps:
    Open Automator and create a New Service.
    Set it to no input in Mail
    From the Utilities Library, drag the run Applescript action into the workflow pane.
    Copy and paste in this script (replacing what is already there):
    property fontName : "Lucida Handwriting"
    property fontSize : 14
    property fontColor : {14848, 26112, 65535} as RGB color
    property emailMessage : "Hello "
    on run {input, parameters}
              tell application "Mail"
                        set theMessage to make new outgoing message with properties {visible:true}
                        set the content of theMessage to emailMessage
                        tell content of theMessage
                                  set the font to fontName
                                  set the size to fontSize
                                  set the color to fontColor
                        end tell
              end tell
    end run
    Change all the Properties to what you want for defaults.
    Save the workflow with a useful name.
    Open Keyboard System Preferences, Shortcuts menu
    Select Services category
    Scroll to the bottom section and find you service; select it.
    Tab the shortcut field and type the shortcut you want to use. Note that a lot of the N shortcuts are used. I found ctrl-opt-N was free.
    Open Mail, go to the Mail menu > Services > name of service
    That will open a new mail window. Close it and try the Shortcut.
    To get the right color values, you can use the color picker, RGB Slider values multiplied by 256. That's not quite perfect, but it is close. The maximum value is 65535

  • When sending mail from iphone to alias the alias gets replaced by primary mail address

    I have a mailbox with 3 aliases.
    I need to be able to send to one of these aliased via my iphone mail, but everytime i do this the alias gets replaced by the primary mail address.
    Help!

    I have the exact same problem. My apple ID is [email protected] , which is not any valid email. when i try to send an email from my icloud, it uses my @mac.com apple ID instead of my [email protected] email and i always fail to send it out. This was also alright when i send through iCloud.com. Hope someone would find a solution for this soon.

Maybe you are looking for

  • RemoveChild issue

    Hi All, Got this code loading thumbs, and when their clicked loads a bigger image etc... function xmlLoaded (e:Event):void { xml = XML(e.target.data); images = xml.image; for(var i:uint=0; i<images.length();i++){ var thumb:MovieClip = new MovieClip()

  • HT4914 How does the payment method work for iTunes Match?

    How does the payment method work with iTunes Match. For example, if you have a gift card, does it take it out of that. Or is there tax? What if you cancel your subscription in the middle of the year, does it take the money for that year or not? If so

  • Adobe DNG Converter failure

    I have used Adobe DNG Converter 8.6 for a few weeks (on Windows 7 Ultimate 64) without incident to batch convert my Canon RAW files to DNG.  However, now when I try to open the program it does not work.  The problem seems to be that the GUI interface

  • Over two weeks and still no phoneline or internet ...

    No phone line or internet...Reported fault on 17th December, told would be fixed by 20th December, Called on 20/21 december to be told the fault was LOST in the system they would close it and re open.... told would be fixed by 25th December then told

  • New Feature Phones in the Future?

    I have been looking at the feature phones that verizon has currently on their website and they haven't changed for some time. As of Feb 1 the data packages have changed and was wondering which of the feature phones currently on the list would require