Email still sends on weekends, confused as to why.

IF((Get-Date).DayOfWeek -ne "Saturday" -ne "Sunday"){Send-MailMessage -SmtpServer $SMTPSERVER -From $From -To $To -Subject $Subject -Body $Body -BodyAsHtml}
Hi Everyone,
Above is my code. I basically only want it to send monday-friday but it still sends on the weekend. Not sure as to why as the (get-date).dayofweek bring back a string value of e.g. Monday. 
What have I done wrong?
If this is helpful please mark it so. Also if this solved your problem mark as answer.

Will this work? I don't see why I need a second IF.
IF((Get-Date).DayOfWeek -ne "Saturday" -ne "Sunday"){Send-MailMessage -SmtpServer $SMTPSERVER -From $From `
-To $To -Subject $Subject -Body $Body -BodyAsHtml}
If this is helpful please mark it so. Also if this solved your problem mark as answer.
That will not work.  When you chain operators like that, the result of each one is passed to the next operator. 
The first -ne operator is doing to return either $true or $false.  then the next -ne is going to compare that to 'Sunday'.  
Powershell will coerce the object on the RH side of the operator to match the type on the LH side.  
In the second -ne, the LH side type is [bool] ($true or $false).
When a [string] is coerced to [bool], any non-empty or null string will evaluate as $true,  so 'Sunday' is always $true.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • I have 4 email accounts in apple Mail.  My mail is sending from the wrong account.  even on "reply" it sends from a different account.  I have 3 gmail accounts and one exchange server account. I choose which account to send from and it still sends from a

    I have 4 email accounts in apple Mail.  My mail is sending from the wrong account.  even on "reply" it sends from a different account.  I have 3 gmail accounts and one exchange server account. I choose which account to send from and it still sends from the same gmail account.  Help.

    I HAD two accounts because of this problem.  I completely removed the problem account from the Apple Mail client.  Guess what is happening??  That's right - Mail is still sending from the other account that no longer exists on my computer, and I have absolutely no idea how this is happening.  This is incredibly frustrating.  When a recipient chooses to reply to my message, quite often I won't get it now because it is going to the other account that has now been deleted from my system.  COME ON APPLE!!! WHAT'S THE DEAL WITH THIS???

  • IPhone 5 no longer receive emails, but can still send emails with yahoo email account. Any ideas to fix?

    iPhone 5 with iOS 8.1.2 stopped receiving mail yesterday. Have yahoo email account. Can still send emails. Have turned device off/on. Have done the dual off/on thing using top button and menu button.   Issue seems to be only with main inbox, as sub folders are receiving mail. Other Apple device is not having issues like this, just on iPhone.

    LAMfromA2 wrote:
    iPhone 5 with iOS 8.1.2 stopped receiving mail yesterday. Have yahoo email account. Can still send emails. Have turned device off/on. Have done the dual off/on thing using top button and menu button.   Issue seems to be only with main inbox, as sub folders are receiving mail. Other Apple device is not having issues like this, just on iPhone.
    Your issue is with the Yahoo email account which is notoriously bad.
    you can try deleting and reinstalling the email account.
    If that doesn't fix it try the yahoo email app.

  • When I send an email with Mail, I often confuse the account which I'm using. The result is that I send a message with the wrong account! Is there a way to avoid this (for example a reminder before the email is sent)?

    When I send an email with Mail, I often confuse the account which I'm using. The result is that I send a message with the wrong account! Is there a way to avoid this (for example a reminder before the email is sent)?

    Hi, thanks for the answer, I did that already. Unfortunatly this doesn't help me at all, as I often forget to check the menu. For me composing the message is writing the text, the subject, the person to who is addressed and than press "send".
    I often forget to check the "from", and this is a problem because the software select itself one of the accounts.
    Isn't there a way at least to put as a default a blank field instead of one of the accounts? or an account which doesn't work so if I forget to specify the "from" I will be rnotofied that the message can't be sent.
    I guess this could be a rather common problem for many people!
    Thanks
    Sergio

  • My email messages are not loading. I have not changed any settings. I can still send messages but cannot receive them

    As of 5:30 pm yesterday my emails stopped coming in. When I open the account it shows I have 23 messages but nothing loads. I can still send messages and my internet connection is strong. How can I fix this?

    Troubleshooting Apple Mail
    What does Mail/Window/Connection Doctor Show? If the server is red, select it and look at the Show Details box.
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages
    SMTP servers keep going offline

  • CUP 5.3 Canceled Request still sending Email

    Hi GRC Experts
    I have a canceled request in CUP that is still sending email to users. Is there a way that I can stop the request from sending more emails? Will Archiving resolve this?
    A swift reply will be appreciated.
    Thanks.
    D

    Sure, the GRC AC application is a Java based application and all the information is stored in JAVA schema in the database, usually the schema name is something like SAPSR3DB.
    Out of curiosity, is that user still getting emails from CUP for the canceled request ?
    Cheers !!
    Zaheer

  • Sending the same email message several times to contacts.  Turned off iCloud, but still sending message.

    Sending the same email message several times to contacts.  Turned off iCloud, but still sending message. 
    A user had synced all of his contacts from his computer and iPhone to his iCloud.  Today, his iCloud sent out the same message 20 times to all recipients.  We were able to transfer all calendar items and contacts back to his pc and then disable iCloud.  However, it still sent out the messages.  Any ideas?

    It's a carrier issue. I have AT&T and had this issue with my friend (who had an Android) and my mother (who had a feature phone). Both of them have Verizon for service and I'm thinking the issue was on Verizon's end. They both just dealt with it as we tried all sorts of things to get this sorted out (other than contacting Verizon directly) and had no luck.
    They've both switched to iPhones so it's a moot point for us now, at least.
    ~Lyssa

  • I have changed my email in apple id support page, but apple is still sending notification in my old email!

    Hi!
    I have changed my email in apple id support page, but apple is still sending notification in my old email! I would like for my old email to be completely wiped out from the apple id database. I cannot seem to find out how, any help appreciated!
    Some more info: in iphone, in icloud and appstore i see the new email address. however i can log in the appstore with the old one as well!!! crazy!
    Thanx!

    Edit: it seems in the iphone i can log in the appstore with the new and the old email. In the apple id website, i can log in only with the new email. Still, it seems apple has my old email somewhere stored.

  • Emails are send. but still some emails are present in OUTBOX

    we have a issue in our infrastructure for few users. the emails are send and shows in send items. but still we can see emails in outbox (not all of them). this is utilizing the mailbox space. any idea how this issue arrived and its fix

    Hi,
    In case it's caused by a corrupted data file, please run Scanpst.exe to fix the data file to check the result.
    Follow the instructions in this kb:
    http://support.microsoft.com/kb/272227/en-us
    If you are using an .ost file, you can simply rename/remove it, then Outlook will generate a new one next time it starts.
    Some corrupted or hidden rules may also cause this problem, you can use MFCMAPI to find and delete these rules to check the result:
    http://mfcmapi.codeplex.com/releases/view/118446
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Regards,
    Melon Chen
    TechNet Community Support

  • My computer is still sending emails from a deleted account.

    I have a very annoying problem. I bought an imac, added my 3 different email accounts as I had been doing with my macbook for years. BUT, I realized that even though I chose my primary business account to send a particular email, sometimes the computer would decide to send it with one of my personal email accounts. Since I could not find a solution to this most inconvenient problem, I deleted my personal email accounts and left only my business email acount.
    Alas, the problem wont disappear! even though I dont have the other accounts anywhere in imail, some of my emails still go from those ghost email accounts!
    Please help me, im getting extremely frustrated and this is causing me serious problems at work.
    Thank you.

    From the Mail menu bar, select
    Window ▹ Connection Doctor
    Look for the unwanted SMTP server in the window that opens. Double-click it. Another window will open, showing a list of all the outgoing mail servers you've defined. The unwanted one will be selected. Click the minus-sign button to delete it, then click OK.

  • After several fixes, I still cannot send emails while on Wi-Fi. Can you explain why this is?

    I have read several community posts of Iphone users who have had the same issues I have, which is emails sent while on WI-Fi do not send. The only why to ensure that the messages are sent I have to turn off the Wi-Fi, which works but is very inconvenient. I spend much of my time not at my desktop and responding to emails. My employer has Wi-Fi available and I don't have to discuss why using Wi-Fi is advantageous. I have tried (unseccessfully) all the troubleshooting suggestions that I have read on Apple support communities. It sounds like only owners of Iphone 5 have these issues. My wife has a refurbished Iphone 4s and she has never complained about sending emails. I want Apple to address this widely shared concern and a resolution that does not require me to turn off my Wi-Fi every time I want to quickly reply to an email.

    There can be a multitude of reasons why you can not send emails while on wifi
    Particularly if your not on your own wifi
    Business wifi may have blocked connections to external mail servers
    If  your using your ISP for mail they may be blocking connection attempts from outside their IP address, range some require authentication to send
    You"ll need to speak to both of your ISP and the network admin of the wifi your using
    When trying to use email and tell them what you're trying to do and what happens
    Since you can send mail while not on wifi
    Your first port of call should be the network admin of the wifi your trying to use
    If it's a business you'll might find external email servers have been blocked 
    It's not apples fault you can't send emails
    Restrictions can set any network to stop users doing things the network owners don't want the users to do
    there is nothing apple can possibly do about it nor would they want to

  • I need help with an email WiFi sending problem on my iPad 2

    I’m having an email WiFi sending problem on my iPad 2     Model:  MC774C/A;  IOS VERSION: 6.1.3 (10B329). 
    While I use 4 email accounts on the iPad -- Hotmail, Gmail, iCloud and ns.sympatico.ca ( a division of BellAliant) – the sending difficulty only relates to the ns.sympatico.ca.  The settings for this account are:         pop.bellaliant.net            and      smtp.bellaliant.net
    I first noticed the problem about 3 weeks ago while travelling across the country (Canada).  (I do recall about that time there was an update of my IOS and I also for my wife purchased from the Bell store an iPhone which shares my Apple account.)  Prior to that everything worked well for a couple of years.
    I noticed earlier this month that the iPad received mail fine but would not send at night using the motels’ WiFi.  During the day, using my 3G account, all worked fine.  I phoned Bell but was told that my experience was normal so I thought no more about it until I returned home and found the same problem at the house.  I called Bell again and worked for 2 hours with 3 Bell technicians who succeeded in getting the iPad to neither send nor receive and gave up advising me to take the iPad into a Bell store to have it looked at.  I did that and the young technician got the iPad sending and receiving by changing the        smtp.bellaliant.net      to         mail.1xbell.ca
    However, when I returned home again, I realized that it was working on my 3G and still doesn’t send on my WiFi
    I’m looking for any suggestions that might solve this annoying problem?

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • Why will IMAP email not send from Mac OS 10.10.1 Yosemite Mail even though it is configured the same as on my old Macbook (and emails are sending just fine on the old computer)?

    I can receive but cannot send IMAP email on my 1&1 mail account from Mac OS 10.10.1 Yosemite Mail on my new Macbook Pro. The account is set up the same port, password, username, server name as on my old Macbook and emails are sending just fine on the old computer.
    When I hit send on the new Macbook Pro running Yosemite I get this message:
    "The connection to host ... on port 993 failed.
    Select a different outgoing mail server from the list below or click Try Later to leave the message in your Outbox until it can be sent."
    It shows the server as (offline)
    I've tried erasing and typing in the password.  I've tried both checking and unchecking Automatically detect and maintain account settings. Still cannot send.
    I also have a Gmail account and it is working...

    email service uses an Incoming Server and an Outgoing Server. Mac Mail makes access to the Incoming Server(s) obvious, and hides the settings for the outgoing Server(s). A quick and easy way to get access to the Outgoing Servewr settings is to use:
    Window > Connection Doctor ...
    ... then click on the red light for the Server that is not working for you to see its settings.
    This web page will make an educated guess about how to set up your Servers, and NO SPAM will follow:
    https://www.apple.com/support/mail-settings-lookup/

  • Can i still send my iphone in for a repair after 10 days?

    Hi Guys
    Sorry if this is in the wrong section.
    Does anyone know if i can still send my iphone in for a repair more than 10 days after receiving my packaging from apple as i noticed on the confirmation email it says if you dont send the phone back within 10 working days the repair will be cancelled. however when i go into my repair status on apples website it is saying my repair is still active.
    Could i still send the phone back even though its been almost a month since i got the packaging?
    Thanks in advance
    Alex

    Probably. However, I'd call first just to confirm.

  • HT3529 i cant add new mail fir I message as every time i add and tyep pass for Apple ID the email still not add to be reached by i message

    i cant add new mail fir I message as every time i add and tyep pass for Apple ID the email still not add to be reached by i message.
    Pls i need to validate my mail adress [email protected] to send and recieve Imessage from my iphone.
    Islam fouad
    +966554948283

    i cant activate Imessage in my iPhone as every time i write my Appel ID and the Password the message appear the User id or password incorrect but 100% sure that its correct.
    Pls feed me back

Maybe you are looking for