51Testing软件测试论坛
标题:
Loadrunner中写SMTP脚本
[打印本页]
作者:
junior777
时间:
2015-7-1 17:33
标题:
Loadrunner中写SMTP脚本
Action()
{
smtp1 = 0;
lr_think_time(1);
lr_start_transaction("SMTP服务器登录");
smtp_logon_ex(&smtp1,"SmtpLogon",
"URL=smtp://xxxx.com",
"LogonUser={LogonUser}@joysinfo.com",
"LogonPass=test",
"CommonName=LoadRunner User",
LAST);
lr_end_transaction("SMTP服务器登录",LR_AUTO);
//邮件附件参数化
smtp_translate_ex(&smtp1,"{AttachRawFile}",
"Content-Type: application/octet-stream;\n name=\"base64_{AttachRawFile}\"\nContent-Transfer-Encoding:"
" base64\nContent-Disposition: attachment;\n filename=\"base64_{AttachRawFile}\"\r\n",
BASE64_ENCODED,"base64_{AttachRawFile}");
lr_start_transaction("SMTP邮件发送");
smtp_send_mail_ex(&smtp1, "SendMail",
"To={toUser}", //收件人
//"Bcc=junior1@joysinfo.com",
"From=<{LogonUser}@joysinfo.com>",
"Subject={num}hi=?gb2312?B?0NTE3LLiytS9xbG+0enWpA==?=", //标题
"ContentType=multipart/mixed;",
MAILOPTIONS,
"From: {LogonUser} <{LogonUser}@joysinfo.com>",
//"To: 51568182 <
51568182@qq.com
>,junior1 <
junior1@joysinfo.com
>",
"To: {toUser_1} <{toUser}>",
"Reply-To: {LogonUser} <{LogonUser}@joysinfo.com>",
"X-Priority: 3",
"X-Has-Attach: yes",
"X-Mailer: Foxmail 7.0.1.88[cn]",
MAILDATA,
"AttachRawFile={AttachRawFile}", //附件信息
"AttachRawFile=mailnote1_01.dat",//邮件具体内容
//"AttachRawFile=mailnote1_03.dat",
LAST);
lr_end_transaction("SMTP邮件发送",LR_AUTO);
smtp_logout_ex(&smtp1);
smtp_free_ex(&smtp1);
return 0;
}
作者:
ntgecm
时间:
2015-7-2 10:26
作者:
丰卉者
时间:
2017-12-23 13:53
最好写一个详细文档上传上来呀,不然还是茫然呢,移动
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2