2 Replies Latest reply on Jul 28, 2016 6:23 AM by madhuri.tanniru

    Issues while emailing out the pdf file using powershell script

    madhuri.tanniru

      HI,

       

      We have a PowerShell script that we use to email out the pdf file . However, we have seen that sometimes emails were sent out to the users without any attachment.

       

      What could be causing the issue? How do I debug the issue?

       

      I am new to the powershell script, can someone please help on debugging the issue we are facing

       

      Thanks,

      -Madhuri

        • 1. Re: Issues while emailing out the pdf file using powershell script
          bishal singh

          嗨Madhuri

           

          请用这个鳕鱼

          应#creating邮件对象
               $味精=新的对象Net.Mail.MailMessage
               $连接=新的对象Net.Mail.Attachment(“$ saved_file”)
               $ attach1 =新的对象Net.Mail.Attachment(“$ saved_file1”)
                $ attach2 =新的对象Net.Mail.Attachment(“$ saved_file2”)
               #----------------------
               #$ att11 =新的对象Net.Mail.Attachment($连接)
              $ attach.ContentType.MediaType =“图像/ PNG”
              $ attach1.ContentType.MediaType =“图像/ PNG”
              $ attach.ContentId =“附件”
              $ attach1.ContentId =“附件1”
               #------------------

               应#creating SMTP服务器对象
               $ SMTP =新的对象Net.Mail.SmtpClient($ smtp_server,$ smtp_server_port)
               $ smtp.Credentials =新对象System.Net.NetworkCredential;
               $ smtp.Timeout = 1000000
              #如果($ config_xml.selectsinglenode('/根/邮箱/ enable_ssl')。“#文本”-eq 1)
               {$ smtp.enablessl = $真实}
              
               #Email结构
               $ msg.From =“$ message_from”
              
               $ msg.To.Add(“$ message_to”)
               $ msg.cc.Add(“$ message_cc”)
              
               $ msg.subject =“$ MESSAGE_SUBJECT”
          #$ msg.body =“你好”+“$ sending_to,$ MESSAGE_BODY”
          #------------------------------------------------- ----------------
          $身体=“<p风格=”FONT-FAMILY:宋体(身体),无衬线'>
          亲爱的,<br /> <br />

          请在下面找到手机银行作为仪表板的$(获取最新-f'YYYY-MM-DD“)
          <br />
          <br />
          <IMG SRC = CID:附件> <br />
          <IMG SRC = CID:附件1> <br />
          <br />
          商祺,<br />


          </ P>“



          $ msg.body = $体
          #------------------------------------------------- -
               $ msg.Attachments.add($连接)
                $ msg.Attachments.add($ attach1)
                $ msg.Attachments.add($ attach2)
               $ msg.IsBodyHTML = $真
               #Sending电子邮件
               $ smtp.Send($味精)
               写日志(“电子邮件发送成功。”)
               #cleans了对下载文件的文件锁
               $ attach.dispose()
               $ msg.dispose()
               写日志(“清除全成”)
               写日志(「认购事项完成“)
               “过程完成”
          }

           

          2 of 2 people found this helpful
          • 2. Re: Issues while emailing out the pdf file using powershell script
            madhuri.tanniru

            Hi Bishal,

             

            Thanks for your reply on this post. Could you please elaborate your message and also , some of the font is not in English.

             

            Thanks,

            -Madhuri