Data Infrastructure Management Software Discussions

error in sending mail

I tried to create a command to send mail with following code.When i test the command it showing following error



$SUBJECT="This is Subject"
$MAIL_BODY="This is testing only"

$SMTP = new-object Net.Mail.SmtpClient(${MAIL_SERVER})
$MSG =New-Object System.Net.Mail.MailMessage "${SENDER}", "${NOTIFY_ID}", "${SUBJECT}", "${MAIL_BODY}"



Re: error in sending mail

Hi Aswani,


Did you try cloning the certified 'send email' command and taking it from there ?


Also, do you know how to send a csv as attachment in a command ? Was just trying to investigate that.



Re: error in sending mail

I tried with the certified sendmail command but getting same error .




My smtp server is working fine when i ping that.

Re: error in sending mail

In the snapshot you sent you were missing a p in netapp and the smtp port was not 25 , but let suppose that is not the problem.


I would start with a telnet the smpt server on port 25 and manually try to send an email to see if the wfa server is authorized to send emails on the smtp sever.



Re: error in sending mail

I also checked mail option present in wfa configuration.

There i have given my smtpserver address it worked fine and i got mail to my outlook.

But i dont understand previous error.







Re: error in sending mail

Try changing this code :


        $smtpClient = New-Object System.Net.Mail.SmtpClient
        $mailMessage = New-Object System.Net.Mail.MailMessage

        $ = $SmtpHost
        $mailMessage.from = $From

        $mailMessage.Subject = $Subject
        $mailMessage.Body = "Email from WFA system:`n"

        $smtpClient.Port = 25

        Get-WFALogger -Info -message $("Sending email to " + $To)

Cloud Volumes ONTAP
Review Banner
All Community Forums