• I follow a format similar to the first code posted.
    The only thing I see in the second posted code is no quotes on the server name.
    -smtpServer smtp.qwerty.org 
    That could have been a copy and past thing but in my code this is my server reference.
    $smtpserver = "mailserver.your_domain.com" #local relay server
    the standard format I use when sending files.  I can include the sql and build csv file if you want it but not 100% on topic.
    {
    $filename = "D:\Powershell\Results\closed_request.csv"
    $smtpserver = "mailserver.your_domain.com" #your server
    $msg = new-object Net.Mail.MailMessage
    $att = new-object Net.Mail.Attachment($filename)
    $smtp = new-object Net.Mail.SmtpClient($smtpServer )
    $msg.From = "mail_admin <donotreply@your_domain.com>"
    $msg.To.Add("Customer Service <customerserviceoffice@your_domain.com>")
    $msg.Cc.Add("real name <some.emailaddress@your_domain.com>")  # add a cc address like yourself so you can call BS when they say you didn't get it.
    $msg.Subject = "Your request has been closed."
    $msg.Body = "Hello, I closed your request. If you want a detailed explanation. Please see the attached file."
    $msg.Body += "Thank you aaaaaand what not"  # add a second body line
    $msg.Attachments.Add($att)
    $smtp.Send($msg)
    Remove-Item D:\Powershell\Results\closed_request.csv
    exit
    }
    I hope that helps.