Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6621351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:15:09+00:00 2026-05-25T21:15:09+00:00

I am using send-mail message to send email to our Support System. But when

  • 0

I am using send-mail message to send email to our Support System.
But when it send email it shows the subject line like this screen!

=?us-ascii?Q?R899076:Aman:System Summary ?=

In Subject I am using the variable:

$vUserName = (Get-Item env:\username).Value
$vComputerName = (Get-Item env:\Computername).Value
$subject = "$vComputerName : $vUserName : System Summary"

and then

send-MailMessage  -SmtpServer Smtp-local -To $to -From $from -Subject $subject -Body $body  -BodyAsHtml -Priority High 

But when I recieve this email in Outlook it looks fine any Idea?


Actually this a approx 150 lines script and the body of email and smtp server are already specified in the server.
yes I tried the $subject = "$env:ComputerName : $env:UserName : System Summary" variable and the result is same.

yes I have tried the – encoding option and it gives an error

Send-MailMessage : Cannot bind parameter ‘Encoding’. Cannot convert the “utf8” value of type “Syste
m.String” to type “System.Text.Encoding”.
At D:\PowerShell\MyScripts\SystemInfo\SysInfo-V6-test[notfinal].ps1:151 char:84
+ send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Encoding <<<< utf8 -B
ody $body -Attachments “$filepath\$name.html” -BodyAsHtml -Priority High
+ CategoryInfo : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SendMai
lMessage

Any clue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:15:10+00:00Added an answer on May 25, 2026 at 9:15 pm

    You could write a custom function to send using .net instead of using the Send-MailMessage cmdlet. It’s a lot clunkier, but gets round the problem.

    Something like this:

    Function SendEmail  ($emailFrom, $emailTo, $subject, $body, $attachment) {
    
    # Create from/to addresses  
    $from = New-Object System.Net.Mail.MailAddress $emailFrom
    $to =   New-Object System.Net.Mail.MailAddress $emailTo
    
    # Create Message  
    $message = new-object System.Net.Mail.MailMessage $from, $to  
    $message.Subject = $subject  
    $message.Body = $body
    
    $attachment = new-object System.Net.Mail.Attachment($attachment)
    $message.Attachments.Add($attachment)
    
    
    # Set SMTP Server and create SMTP Client  
    $server = <your server> 
    $client = new-object system.net.mail.smtpclient $server  
    
    # Send the message  
    "Sending an e-mail message to {0} by using SMTP host {1} port {2}." -f $to.ToString(), $client.Host, $client.Port  
    try {  
       $client.Send($message)  
       "Message to: {1}, from: {0} has beens successfully sent" -f $from, $to  
    }  
    catch {  
      "Exception caught in CreateTestMessage: {0}" -f $Error.ToString()  
    } 
    
    }
    

    (Thanks to Thomas Lee (tfl@psp.co.uk) – I tweaked this from his code at http://powershell.com/cs/media/p/357.aspx)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, our application uses a javax.mail to send email, using javax.mail.MailMessage. We set the
I'm trying to send an e-mail with Codeigniter like this: $this->load->library('email'); $this->email->from(myemail@email.com); $this->email->reply_to(myemail@email.com); $this->email->to(myemail@email.com);
I used this coding to send mail using gmail, but am getting the below
I'm trying to send an email message using the .NET MailMessage class which can
Hi I'm using System.Net.Mail to send some HTML formatted emails. What is the correct
I am using PEAR mail system to send authenticated mails.I need to send HTML
I'm using System.Net.Mail to send out a few emails. The emails are being sent
I'm creating an email message using CDO object (and VB6, but that doesn't really
I am trying to send email using apache james with this code public static
Our application is sending our emails with Word attachments using System.Net.Mail. We have empty-string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.