This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/02-Keyword/tsg_common/StmpHandle.robot
2020-04-01 12:42:05 +08:00

44 lines
2.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

*** Settings ***
Library Smtp3Library
*** Keywords ***
EmailLogin
[Arguments] ${SURL} ${SPORT} ${SUSER} ${SPWD}
[Documentation] [${SURL}:邮箱发送服务器比如腾讯企业邮箱smtp.exmail.qq.com;qq邮箱smtp.qq.com;163邮箱smtp.163.com等]
... [${SPORT}邮箱发送服务器的端口无论是哪种邮箱的一般是25该值可灵活填充]
... [${SUSER}:邮箱登入用户名,无需转码]
... [${SPWD}:登入密码。对于腾讯企业邮箱密码无变化qq邮箱需要第三方授权码登入163邮箱需要第三方授权码登入]
... [关键字返回值这是163邮箱的返回结果不同邮箱可能不太一样(235, b'Authentication successful')]
[Tags] function email send
Prepare Connection ${SURL} ${SPORT} ${SUSER} ${SPWD}
Connect
Ehlo
${result} logins
run keyword if "${result}"=="fail" log ${result}
... ELSE Quit Close Connection
#Quit
#Close Connection
[Return] ${result} # 返回登入结果
EmailSendFull
[Arguments] ${SURL} ${SPORT} ${SUSER} ${PWD} ${SUBJ} ${FROM} ${to} ${cc} ${bcc} ${Sbody} ${attach}
[Documentation] [注意:所有参数都是必填参数]
... [${SURL}:邮箱发送服务器比如smtp.qq.com]
... [${SPORT}:邮箱服务器写法如25]
... [${SUSER}:登入名zhangsan@qq.com]
... [${PWD}:登入密码不同类型的邮箱登入密码需求不一样具体看EmailLogin关键字对于密码的要求]
... [${SUBJ}主题111111]
... [${FROM} :发送者例如zhangsan@qq.com]
... [ ${to} :接收者,可以写多个,写法例如:["lisi@qq.com","wangwu@163.com"] ,若写单个接收者["lisi@qq.com"] ]
... [${cc}:抄送者。可以写多个,写法同${to}]
... [${bcc}:密送者。可以写多个,写法同${to}]
... [${Sbody}:邮件正文写法如1234teacher]
... [${attach}:附件文本,可以写多个,注意本地是否有这些文件。写法如:["1.txt","E://abc.txt"]]
... [关键字返回值:发送成功会返回{},空的内容]
[Tags] function email send
Prepare Connection ${SURL} ${SPORT} ${SUSER} ${PWD}
${send_result} Send Message With All Parameters ${SURL} ${SUSER} ${PWD} ${SUBJ} ${FROM} ${to} ${cc} ${bcc} ${Sbody} ${attach}
Comment Send Message
Close Connection
[Return] ${send_result} # 返回发送邮件结果