Send-MailMessage CommandNotFoundException

Hi, I have no issues running the Send-MailMessage on the Windows powershell on the server. However on the SQL powershell or through SQL Agent I get this message: The version is 2.0
SQL powershell :   + FullyQualifiedErrorId : CommandNotFoundException
SQLAgent shows: The term 'Send-MailMessage' is not recognized as the name of a cmdlet, function, script file, or operable program
Thank you
Paula

I did it on windows powershell as I mentioned there everything works fine.
On SQL :
PS SQLSERVER:\SQL\DEFAULT> Add-pssnapin SqlServerProviderSnapin100
The term 'Add-pssnapin' is not recognized as the name of a cmdlet, function, sc
ript file, or operable program. Check the spelling of the name, or if a path wa
s included, verify that the path is correct and try again.
At line:1 char:13
+ Add-pssnapin <<<<  SqlServerProviderSnapin100
    + CategoryInfo          : ObjectNotFound: (Add-pssnapin:String) [], Comman
   dNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
PS SQLSERVER:\SQL\DEFAULT> Add-pssnapin SqlServerCmdletSnapin100
The term 'Add-pssnapin' is not recognized as the name of a cmdlet, function, sc
ript file, or operable program. Check the spelling of the name, or if a path wa
s included, verify that the path is correct and try again.
At line:1 char:13
+ Add-pssnapin <<<<  SqlServerCmdletSnapin100
    + CategoryInfo          : ObjectNotFound: (Add-pssnapin:String) [], Comman
   dNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Paula

Similar Messages

  • Powershell : Send-MailMessage -Body paramenters is not working with commands like (Get-ExchangeServer) etc

    I am trying to send email from Powershell .
    When i run this:
    Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email" -Body  "This is Test Email" -SmtpServer "mail01.xxx.xx"
    then i successfully receive email .
    But when i try to use other commands in -Body parameter then it gives error:
    For example:
     Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email"
    -Body (Get-ExchangeServer) -SmtpServer "mail01.xxx.xx"
    Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String'
     required by parameter 'Body'. Specified method is not supported.
    At line:1 char:96At line:1 char:116
    + Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email" -Body (Get-ExchangeServer <<<< ) -SmtpServer "mail01.xxx.xx"
        + CategoryInfo          : ObjectNotFound: (Get-ExchangeServer:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    My requirement is to send email from powershell and send exchange related data in email.

    OK I got it .. The solution is to add Out-String
    Send-MailMessage -From "[email protected]" -To "[email protected]" -Subject "Test email"
    -Body (Get-ExchangeServer | Out-String) -SmtpServer "mail01.xxx.xx"

  • How to send a message with Send-MailMessage cmdLet powershell exchange which uses a html file as a parameter

    Before the mailboxes migration E2003 toward E2010 SP2, I have to send a mail which body already exists as a html file.
    Here the powershell I currently use :
    import-csv d:\path\TestLot.csv  | foreach {Send-MailMessage -To $_.PrimarySmtpAddress -From
    [email protected] -Subject "Migration " -body "Your mailbox Migration will start in 2 days." -SmtpServer servXXX}
    And it is allright !
    But, I was asked to use an existing html file instead of my poor : -body "Your mailbox Migration will start in 2 days." 
    Does anybody know the way to do this ?
    Thank you for your help
    PATMOY
    BOAT

    Hi,
    I have the html code in a variable so i can personalize the mails:
    $htmlcode = '<html><body style="background:#FFFFFF"><head><title>Activaion email</title></head>'
    $htmlcode += '<style type="text/css">'
    $htmlcode += '#HLine { font-size:20px; font-family:Verdana; font-weight: bold; }'
    $htmlcode += '#txt { font-size:12px; font-family:Verdana;}'
    $htmlcode += '</style>'
    $htmlcode += '<img src="/img/HBPMAN0aGcc.gif" width="52" height="52" />&nbsp;&nbsp;&nbsp;<br />'
    $htmlcode += '<h1 id="HLine">Your BlackBerry account has been created ...</h1>'
    $htmlcode += '<div id="txt"><strong>... Your User Data:</strong><br />'
    $htmlcode += '&nbsp;&nbsp;&nbsp;<br /><table border="0" id="txt"><tr><td>&nbsp;&nbsp;<strong>Username:</strong></td><td>'+$UsrData.Email+'</td></tr>'
    $htmlcode += '<tr><td>&nbsp;&nbsp;<strong>Activation Password:</strong></td><td>'+$UsrData.pass+'</td></tr></table><br />'
    $htmlcode += '<strong>The activation credentials are valid for just 5 days after receipt of this email!</strong><br /><br/ >'
    $htmlcode += '<strong>... Next Steps: </strong><br /><br />'
    $htmlcode += '<a href= "/bb/doc/EN.pdf">- Activate your Device</a>&nbsp;<br />'
    $htmlcode += '&nbsp;&nbsp;To be able to use your new BlackBerry you need to complete this steps.<br /><br />'
    $htmlcode += '<a href= "/bb/doc/Tips.pdf">- Tips and Tricks for your Device</a><br />'
    $htmlcode += '&nbsp;&nbsp;Tips and Tricks to make your Device experience a success.<br /><br />'
    $htmlcode += '<strong>... in case you require technical support:</strong><br /><br />'
    $htmlcode += 'If you experiance problems with your Device, please contact your local IT-Support.<br /><br />'
    $htmlcode += 'Thank You.'
    $htmlcode += '<br/><div></body></html>'
    Send-MailMessage -to $UsrData.Email -From $from -Body $htmlcode -SmtpServer $smtp -Subject $subject -BodyAsHtml
    If you want to make sure the mail is displayed as a HTML Mail add to the send-mailmessage the option
    -BodyAsHtml
    Regards
    Dan

  • Send text file content as the body of an email using Send-MailMessage

    I am taking the last 8 lines of a bunch of robocopy logs and bunching them together.  
    Get-ChildItem -Filter *.log | ForEach {
    $a += Get-Content $_.Name | Select -Last 8
    $a += Write-output ' '`r
    $a += Write-Output '------------------------------------------------------------------------------'`r
    I then wanted to use this as the body of an email (send-mailmessage).  It all works but the formatting is lost in the email. I've tried using Out-String and ConvertTo-HTML with little luck.
    If I look at $a in the above it looks fine in the PowerShell console it's just lost when it reaches my inbox.
    I am using v2 of PowerShell and sadly can't upgrade it.

    The issue isn't that part. It's the content of the log files that loses its formatting.
    $a += Get-Content $_.Name | Select -Last 8

  • How to send digitally sign S/MIME messages with Powershell cmdlet Send-MailMessage?

    Hello,
    using AD Windows PKI I assigned a certificate EKU (1.3.6.1.5.5.7.3.4) to sign emails and get this with
    autoenrollment also to my CERT Store PS
    CERT:\CurrentUser\UserDS\ or the certificate could found via MMC / certificates in the store structur under "Active Directory User Object".
    Signed messages (red icon) to send as S/MIME message using Outlook 2010 is not a problem.
    Using PowerShell cmdlet Send-MailMessage to be sent company notification for a new passwordpolicy some days before pwd expired?! I use the cmdlet already successfully to filling HTML bodies with variables and send to individuals accounts.
    Reduced simplified PS code:
    $SMTPBodyHtmlTemplate = Get-Content "C:\PS\Template\HTMLBody.html" | Out-String
    Function SendEmailNotification # /* SEND E-MAIL Notification to User */#
    [string] $SMTPServer = "mail.domain.local"
    $CurrentUser = "$env:username"
    [string]$SMTPFrom = (Get-ADUser $CurrentUser -properties mail).mail
    [string[]] $SMTPTo = $($Obj.EmailAddress)
    [string]$SMTPSubject = "Notification!"
    [String]$SMTPBodyHtml = $SMTPBodyHtmlTemplate.Replace("UserDisplayname","$($UserDisplayname)")
    Send-MailMessage -From $SMTPFrom -To $SMTPTo -Subject $SMTPSubject -BodyAsHtml $SMTPBodyHtml -dno OnFailure -SmtpServer $SMTPServer -encoding ([System.Text.Encoding]::UTF8) -ErrorAction Continue
    How can I use the PSDrive own CERT and using PowerShell cmdlet Send-MailMessage
    to send a signed message, without development experience?
    Thanks in advance for cooperation.
    Manfred Schüler

    Hi,
    could create with an other colleague a DLL file (with this informations) for successfully sending sign messages from PS-Script. 
    Function SendEmailNotification # /* SEND SIGN E-MAIL */#
    $SMTPBodyHtmlTemplate = Get-Content "C:\PS\Template\HTML.html" | Out-String
    [System.Reflection.Assembly]::LoadFile("C:\PS\Assembly\Cpi.Net.SecureMail.dll") | Out-Null
    [string]$strSmtpServer = "smtp.domain.local"
    [string]$strSmtpPort = "25"
    [string]$strFrom = (Get-ADUser $CurrentUser -properties mail).mail
    [string]$strFromAlias = (Get-ADUser $CurrentUser -properties DisplayName).DisplayName
    [string]$strTo = $UserEmailAddress
    [string]$strToAlias = $UserEmailDisplayName
    [String]$strSubject = "Subject as you like"
    [string]$strBody = $SMTPBodyHtmlTemplate.Replace("UserDisplayname","$($UserDisplayname)")
    $objMail = New-Object Cpi.Net.SecureMail.SecureMailMessage
    $objFrom = New-Object Cpi.Net.SecureMail.SecureMailAddress($strFrom,$strFromAlias,$objCert,$objCert)
    $objTo = New-Object Cpi.Net.SecureMail.SecureMailAddress($strTo,$strToAlias)
    $objMail.From = $objFrom
    $objMail.to.Add($objTo)
    $objMail.Subject = $strSubject
    $objMail.Body = $strBody
    $objMail.IsBodyHtml = $TRUE
    $objMail.IsSigned = $TRUE
    $objMail.IsEncrypted = $FALSE
    $objSMTPClient = New-Object System.Net.Mail.SmtpClient($strSmtpServer,$strSmtpPort)
    $objSMTPClient.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
    $objSMTPClient.send($objMail)
    Maybe Microsoft can implement this in future versions of the cmdlets Send-MailMessage ;-)
    Manfred Schüler

  • Send-Mailmessage Query

    Hi All
    Am trying to send an email with attachment in body (HTML format ) which is coming fine without any issue
    but i need to add few test message in body, ...like .. HI All please see the below report or something
    The attachment is the output of the one scripts stores in local drive (d:\output) as HTML file
    Vatriable $html is outputfile which is showing in the body
        $notificationto = "[email protected]
        $cc = "[email protected]"
        $notificationfrom = "[email protected]"
        $smtpserver = "smtp.labbites.coml"
    Send-MailMessage -Body "$Html"-bodyashtml -to $notificationto -CC $CC -from $notificationfrom -Subject "Report from App notes" -SmtpServer $smtpServer 
    How do i add additional test messgae in the body along with the HTML report

    Hi,
    For this issue, actually, we have a dedicated support team regarding Script. I recommend you ask your question on the Script forum which is staffed by more experts specializing in this kind of problems to get better help.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
    Thanks for kindest understanding.
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

  • Passing the content of txt file to body of Send-MailMessage

    Hi,
    I am trying to send a report using send-mailmessage cmdlet and I am unable to pass the content of the file as it is to body of the message. It gets converted to a single line string (the escape character aren't getting recognized) or body of the mail has
    system.object[] as output.
    Script1:
    $body = Get-Content -Path C:\TEMP\Body.txt | Out-String
    Send-MailMessage -To <toaddress> -Cc <ccaddress> -From <fromaddress> -Subject "$subject" -Body [string]$body -BodyAsHtml -SmtpServer $server
    Error:
    Body of the mail is seen as [string]<content in a continous line>. The actual body in the txt doc is written as we generally write emails
    Script2:
    $body = Get-Content -Path C:\TEMP\Body.txt
    Send-MailMessage -To <toaddress> -Cc <ccaddress> -From <fromaddress> -Subject "$subject" -Body $body -BodyAsHtml -SmtpServer $server
    Error:
    Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified method is not supported.
    At line:1 char:149
    + ... subject" -Body $body -BodyAsHtml -SmtpServer $server
    +                    ~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
        + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SendMailMessage
    Script3:
    $body = [string]::Join("`r`n",(Get-Content -Path C:\TEMP\Body.txt))
    Send-MailMessage -To <toaddress> -Cc <ccaddress> -From <fromaddress> -Subject "$subject" -Body $body -BodyAsHtml -SmtpServer $server
    Error:
    Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified method is not supported.
    At line:1 char:149
    + ... subject" -Body $body -BodyAsHtml -SmtpServer $server
    +                    ~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
        + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SendMailMessage
    Thanks in Advance,
    Ankush Shah

    removing the -BodyAsHTML I am getting the below error
    Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified
    method is not supported.
    At line:1 char:149
    + ... subject" -Body $body -SmtpServer $server
    + ~~~~~
    + CategoryInfo : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SendMailMessage

  • Error in send-mailmessage command

    Hello,
    I am executing the powershell command  to send mails from internal SMTP Server but when am executing this command getting error as "Unable to connect to the remote server".I have checked no port blocking this ,no anti virus is installed. the
    machine have permission to relay the mail.
    Please help me to resolve the issue.
    Thanks 
    RICHA KM

    Are you using an alternate port for SMTP? Send-MailMessage has a parameter to specify an alternate port to use if that is the case. If you run the following command (replace 'computername' and 'port' with the system you are attempting to connect to)...
    (New-Object Net.Sockets.TCPClient -ArgumentList "Computername","Port").Connected
    ...does it come back as true for the open port?
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • Send-mailmessage cmdlet not sending mail

    hi
    I am using send-mailmessage cmdlet in one scripts from my domain machine to send one attachment to my user id. I have added my IP on SMTP/Relay server also.
    Send-mailmessage -from "user1 <[email protected]> -to "user2 <[email protected]>" -subject " Test Mail " -attachment " File details "
    -smtp <IP>
    This cmdlet executes without any error but mail is not trigeer to respective user. Telnet to smtp server works from my machime on 25 port.
    OS - Win 7 SP1 ; Powershell Ver - 2.0
    Help me what need to check more.

    Hi,
    As a troubleshooting step, try using BLAT via CMD to make sure that the issue isn't server related:
    http://sourceforge.net/projects/blat/
    Don't retire TechNet! -
    (Don't give up yet - 12,575+ strong and growing)

  • Send-MailMessage and Automatic Email Generation with Exchange 2007

    Good morning everyone,
    Is it possible to create a powershell script to automatically send messages with Send-MailMessage? I've been asked if we can make Exchange/Outlook automatically generate its own emails to send. My answer was no, you generally need a third party tool to do
    this, such as SendLater or have an application that processes emails through Exchange automatically.
    Then we came upon Send-MailMessage and while I can send emails to myself all night and day, I need to know if I can send with this command automatically throughout the day. I'm somewhat still new to powershell scripting and not sure where to begin or if
    this is even possible.
    Thanks for any assistance!

    Hi ExAdmin29,
    Great information from Ed.
    I also find a related blog contains detailed steps, for your reference:
    Creating Scheduled Tasks for Exchange 2010 PowerShell Scripts
    http://www.mikepfeiffer.net/2010/02/creating-scheduled-tasks-for-exchange-2010-powershell-scripts/
    Disclaimer:
    Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure
    that you completely understand the risk before retrieving any suggestions from the above link.
    Thanks
    Mavis
    Mavis Huang
    TechNet Community Support

  • Powershell send-mailmessage error - helo command rejected: need fully-qualified

    did you try the From and To email addresses in the format of
    "User01 "
    "User02 "
    Like the examples here?
    https://technet.microsoft.com/en-us/library/hh849925.aspx

    Hello,I need help with sending e-mails via Powershell using SMTP authentication. I've described the problem here on StackOverflow already:
    http://stackoverflow.com/questions/31542444/powershell-send-mailmessage-error-helo-command-rejected-...Re-pasting here: """I've read many sources regarding this issue, but no luck :/I am trying to use Powershell 4.0 (Windows server 2012 R2) to send e-mails via the Send-MailMessage commandlet in this way:PHP$From = "[email protected]"$To = "[email protected]"$Subject = "e-mail odeslany z powershellu :)"$Body = "..."$SMTPServer = "smtp.mydomain.cz"$SMTPPort = "587"$credentials = new-object Management.Automation.PSCredential “[email protected]”, (“xxxpasswordxxx” | ConvertTo-SecureString -AsPlainText -Force)Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -SmtpServer...
    This topic first appeared in the Spiceworks Community

  • Send-Mailmessage command not working always

    Hi Experts,
    When i execute scripts with send-mailmessage command it works sometimes and sometimes it is not working :(
    i believe this is due to timeout issue or the server is busy at the time of script execution. Please find the error message below
    I need to make sure this command works and we get emails because I'm planning to make this script in schedule job.
    is there anyway to write a script like if this commands show this error, execute same command until it sends the email.
    Regards, Nidhin.CK

    Hi Rhys,
    Sorry above mentioned code was not working so i tried below code and its working fine
    $i = 0
    Do{
    $MailError = $null
    try{
    Send-MailMessage -SmtpServer $smtpservername -To $toaddress -From $fromaddress -Subject $subject -Body $body -BodyAsHtml -ErrorAction Stop
    catch{
    $MailError = $_.Exception.Message
    if ($MailError -ne $null){
    $i++
    Write-Output "[SOX1] - " $i
    Start-Sleep -Seconds 5
    } else {
    $i = 0
    }while ($i -ne 0)
    Regards, Nidhin.CK

  • Task Scheduler PS1 with convertto-html and send-mailmessage doesn't deliver HTML, works in E201SP2RU5 EMS

    When I run the script below from EMS it's delivered with the expect HTML table. but if I run it from a task in task scheduler the html is missing.
    I've tried launching it in Task scheduler a couple different  ways with the same results.  This is what I'm using now:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -ServerFqdn exchange.domain.com; C:\scripts\TESTER.PS1"
    Any ideas?
    =========================
    $a = "<style>"
    $a = $a + "BODY{background-color:White;}"
    $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
    $a = $a + "TH{border-width: 1px;padding: 5px;border-style: solid;border-color: black;background-color:LightSteelBlue}"
    $a = $a + "TD{border-width: 1px;padding: 5px;border-style: solid;border-color: black;background-color:Linen}"
    $a = $a + "</style>"
    $MBexportBatchRprt = Get-MailboxExportRequest -ResultSize unlimited -BatchName Test-Batch |
        sort name | Get-MailboxExportRequestStatistics |
        select Name,PercentComplete,status,StartTimestamp,CompletionTimestamp,OverallDuration, EstimatedTransferSize, EstimatedTransferItemCount, BadItemsEncountered |
        ConvertTo-Html -Head $a |
        Out-String
    $messageParameters = @{                       
        Subject = "Report 1"                       
        Body = "Contact [email protected] with problems. <br/><br/> $MBexportBatchRprt"
        From = "[email protected]"                       
        To = "[email protected]"                       
        SmtpServer = "exchange.domain.com"                       
    Send-MailMessage @messageParameters -BodyAsHtml 
    =========================

    When I run the script below from EMS it's delivered with the expect HTML table. but if I run it from a task in task scheduler the html is missing.
    I've tried launching it in Task scheduler a couple different  ways with the same results.  This is what I'm using now:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -ServerFqdn exchange.domain.com; C:\scripts\TESTER.PS1"
    Any ideas?
    =========================
    $a = "<style>"
    $a = $a + "BODY{background-color:White;}"
    $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
    $a = $a + "TH{border-width: 1px;padding: 5px;border-style: solid;border-color: black;background-color:LightSteelBlue}"
    $a = $a + "TD{border-width: 1px;padding: 5px;border-style: solid;border-color: black;background-color:Linen}"
    $a = $a + "</style>"
    $MBexportBatchRprt = Get-MailboxExportRequest -ResultSize unlimited -BatchName Test-Batch |
        sort name | Get-MailboxExportRequestStatistics |
        select Name,PercentComplete,status,StartTimestamp,CompletionTimestamp,OverallDuration, EstimatedTransferSize, EstimatedTransferItemCount, BadItemsEncountered |
        ConvertTo-Html -Head $a |
        Out-String
    $messageParameters = @{                       
        Subject = "Report 1"                       
        Body = "Contact [email protected] with problems. <br/><br/> $MBexportBatchRprt"
        From = "[email protected]"                       
        To = "[email protected]"                       
        SmtpServer = "exchange.domain.com"                       
    Send-MailMessage @messageParameters -BodyAsHtml 
    =========================

  • How do I avoid .bin attachments with SmtpClient.Send(MailMessage)?

    I'm hitting the problem
    described here. However, I don't see any way with MailMessage to set the ordering of the content of the email.
    How can I fix this?
    MailMessage mail = new MailMessage(new MailAddress(emailTempKeysFrom, "Windward Studios"), new MailAddress(to[0], pur.Account.Name));
    mail.Body = txt;
    AlternateView htmlView = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html);
    int num = 0;
    foreach (MemoryStream mem in imagesTempKeys)
    mem.Position = 0;
    LinkedResource res = new LinkedResource(mem);
    res.ContentId = "image" + num;
    res.TransferEncoding = TransferEncoding.Base64;
    htmlView.LinkedResources.Add(res);
    num++;
    mail.AlternateViews.Add(htmlView);
    mailObj.Send(mail);
    thanks - dave
    What we did for the last 6 months -
    Made the world's coolest reporting & docgen system even more amazing

    Hello,
    Not sure if you have already seen this
    ContentDisposition Class, with it, sending a CSV file by using stmpclient, I can received the file with the correct format in the Outlook:
    static void Main(string[] args)
    try
    SmtpClient client = new SmtpClient();
    client.Credentials = new System.Net.NetworkCredential(usename,password);
    client.EnableSsl = true;
    client.Port = 587; // Gmail works on this port
    client.Host = "smtp.gmail.com";
    MailAddress from = new MailAddress(from)
    // Set destinations for the e-mail message.
    MailAddress to = new MailAddress(to);
    // Specify the message content.
    MailMessage message = new MailMessage(from, to);
    message.Body = "This is a test e-mail message sent by an application. ";
    // Include some non-ASCII characters in body and subject.
    string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
    message.Body += Environment.NewLine + someArrows;
    message.BodyEncoding = System.Text.Encoding.UTF8;
    message.Subject = "test message 1" + someArrows;
    message.SubjectEncoding = System.Text.Encoding.UTF8;
    string file = "Sample20150126.csv";
    // Create the file attachment for this e-mail message.
    Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
    // Add time stamp information for the file.
    ContentDisposition disposition = data.ContentDisposition;
    disposition.CreationDate = System.IO.File.GetCreationTime(file);
    disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
    disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
    // Add the file attachment to this e-mail message.
    message.Attachments.Add(data);
    // Set the method that is called back when the send operation ends.
    client.SendCompleted += new
    SendCompletedEventHandler(SendCompletedCallback);
    // The userState can be any object that allows your callback
    // method to identify this send operation.
    // For this example, the userToken is a string constant.
    string userState = "test message1";
    client.SendAsync(message, userState);
    Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
    string answer = Console.ReadLine();
    // If the user canceled the send, and mail hasn't been sent yet,
    // then cancel the pending operation.
    if (answer.StartsWith("c") && mailSent == false)
    client.SendAsyncCancel();
    // Clean up.
    message.Dispose();
    Console.WriteLine("Goodbye.");
    catch (Exception e)
    Console.WriteLine(e);
    private static void SendCompletedCallback(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
    mailSent = true;
    Console.WriteLine("Sent");
    Please have a try and if this does not work, please feel free to let me know.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Cannot send email from Powershell on Mailbox Role

    Hi,
    I am trying to send an email from Powershell on Mailbox role of Exchange server. I have installed Symantec Mail Security on Mailbox Role.
    When I try to send email using Powershell, I got the following error.
    PS C:\a> Send-MailMessage -to [email protected] -Subject "Alert Closed.. Service is restarted on Computer" -from
    [email protected] -Body "The service was found stopped on Computer it was started automatically and it is now running normally." -bodyasHTML -priority High -SmtpServer smtp.domain.com
    Send-MailMessage : Service not available, closing transmission channel. The server response was: 4.3.2 Service not active
    At line:1 char:1
    + Send-MailMessage -to [email protected] -Subject "Alert Closed.. Service is ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException
        + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
    This command is working fine on every server except exchange server (CAS, Mailbox). Firewall is off on the servers.
    Any help will be highly appreciated.
    Regards,
    Anees

    Hi,
    Please check the similar thread .
    http://social.technet.microsoft.com/Forums/exchange/en-US/ef699832-8da9-4709-9a50-c6223b13bd95/sendmailmessage-returns-the-server-response-was-432-service-not-available?forum=exchangesvrsecuremessaginglegacy
    smtp server (smtp.domain.com) is rejecting the connection from the
     Mailbox role of Exchange server.
    So please allow the mailbox server ip address on the smtp server's (i.e. smtp.domain.com)
    receive connector to get it done 
    Regards
    S.Nithyanandham
    Thanks S.Nithyanandham

Maybe you are looking for

  • How to use Logic DataBase in WDA?

    Hi Experts, The LDBs contain: Selection Screen, Authorization check, Data Retrieval, and it is very useful for writing a report within R3 system. I am developing some WDA reports, and really need this kind of features too. Is there anyone know how to

  • Getting Error 2350 with itunes 7

    Help I keep getting an error message that says itunes.cab won't install--error 2350 at first was having trouble with quick time solved that went through trouble shooting-removed itunes 6 and now version 7 will not install--have a nano 4gb-my son is g

  • Movies in Help File not playing

    Hi We have released software with a .chm help file. The help file contains embedded Captivate movies. Some users are having trouble playing the movies, they see a blank screen where the movie should be. Clearing the IE cache has a helped some users b

  • "Application Manager Failed to Install"

    I get two errors when trying to download CC for PS: " We've encountered the following issue: Application Manager Failed to Install and "Download Error. Adobe Application Manager is corrupted and must be reinstalled. Please Conact Customer Service" An

  • "disk full" error, tried suggestions mentioned here

    Hey, My Zen Nano Plus doesn't work properly anymore... When I tried to copy some new files I got a pop-up which said that my disk was full, and according to the properties, it was indeed using all of the 52 MB disk-space. After deleting some 20 songs