PowerProtect smtp_send.py會產生錯誤:「NoneType」物件沒有屬性「encode」

Summary: PowerProtect Data Manager 用於保護環境,「支援電子郵件設定」>設定為接收電子郵件通知。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Symptoms

電子郵件設定測試電子郵件失敗,指出正在驗證簡單郵件傳輸協定 (SMTP) 的詳細資訊。

Error
104: Sending the test email failed. Socket error : mailserver.mydomain.com
Verify the SMTP details and try again. 

PowerProtect Data Manager 包含 /usr/local/brs/bin/smtp_send.py 腳本,以幫助解決 SMTP 相關問題。指令檔無法執行,並產生下列資訊:

admin@my-ppdm:~> /usr/local/brs/bin/smtp_send.py -HOST mailserver.mydomain.com -FROM test_email_address@dell.com -PORT 25 -ARGS True -S "PowerProtect Data Manager test email" -C plain -R test_email_address@dell.com
Traceback (most recent call last):
  File "/usr/local/brs/bin/smtp_send.py", line 338, in <module>
    main()
  File "/usr/local/brs/bin/smtp_send.py", line 308, in main
    outer.attach(MIMEText(args.body, args.content_type))
  File "/usr/lib64/python3.4/email/mime/text.py", line 33, in {}init{}
    _text.encode('us-ascii')
AttributeError: 'NoneType' object has no attribute 'encode' 

Cause

可使用 smtp_send.py 說明顯示所有命令都是可選的,但其中大多數是必需的:

admin@my-ppdm:~> /usr/local/brs/bin/smtp_send.py -h

usage: smtp_send.py [-h] [-HOST MAILSERVER] [-PORT PORT] [-USER USERNAME]
                    [-PASS PASSWORD] [-FROM MAILFROM] [-ARGS USEARGS]
                    [-R RECIPIENTS [RECIPIENTS ...]] [-S SUBJECT]
                    [-C CONTENT_TYPE]
                    [-T {MAIL_BODY_AS_ARGUMENT,MAIL_BODY_AS_ATTACHMENT,MAIL_BODY_FROM_FILE}]
                    [-p TIMEOUT] [--hide] [-F FILENAME | -B BODY]
optional arguments:
  -h, --help            show this help message and exit
  -HOST MAILSERVER      Mail server
  -PORT PORT            Mail port
  -USER USERNAME        Mail username
  -PASS PASSWORD        Mail password
  -FROM MAILFROM        Mail from
  -ARGS USEARGS         Use args
  -R RECIPIENTS [RECIPIENTS ...]
                        Mail recipients
  -S SUBJECT            Mail subject
  -C CONTENT_TYPE       Content Type
  -T {MAIL_BODY_AS_ARGUMENT,MAIL_BODY_AS_ATTACHMENT,MAIL_BODY_FROM_FILE}
                        Message type
  -p TIMEOUT            Timeout in minutes
  --hide                hide to field from recipients
  -F FILENAME, --Files FILENAME
                        File to be attached
  -B BODY, --Body BODY  Message body

Resolution

使用時,必須使用參考的所有選項 smtp_send.py 文稿,而不是依賴於 "help" 命令輸出。語法與輸出範例:

admin@my-ppdm:~> /usr/local/brs/bin/smtp_send.py -HOST mailserver.mydomain.com -FROM test_email_address@dell.com -PORT 25 -ARGS True -T MAIL_BODY_AS_ARGUMENT -S "PowerProtect Data Manager test email" -B "This is a test email from a PowerProtect Data Manager appliance" -C plain -R test_email_address@dell.com
2023-11-08 18:05:10.150515 INFO : Sending email with subject : PowerProtect Data Manager test email
2023-11-08 18:05:10.866943 INFO : sending mail
2023-11-08 18:05:11.071116 INFO : result: {}
admin@my-ppdm:~>

Additional Information

必需參數:
  -HOST MAILSERVER      Mail server
  -FROM MAILFROM        Mail from
  -ARGS USEARGS         Use args
  -R RECIPIENTS [RECIPIENTS ...]
                        Mail recipients
  -S SUBJECT            Mail subject
  -C CONTENT_TYPE       Content Type
  -T {MAIL_BODY_AS_ARGUMENT,MAIL_BODY_AS_ATTACHMENT,MAIL_BODY_FROM_FILE}
                        Message type
  -B BODY, --Body BODY  Message body
選用引數:
  -h, --help            show this help message and exit
  -PORT PORT            Mail port
  -USER USERNAME        Mail username
  -PASS PASSWORD        Mail password
  -p TIMEOUT            Timeout in minutes
  --hide                hide to field from recipients
  -F FILENAME, --Files FILENAME
                        File to be attached
Article Properties
Article Number: 000219362
Article Type: Solution
Last Modified: 03 Dec 2025
Version:  3
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.