简体   繁体   English

用经典ASP发送邮件时出现网址问题

[英]Url Issue while sending mail in classic asp

I have an classic asp application which is trying to send a mail on a particular event and this is how the code goes: 我有一个经典的ASP应用程序,它尝试在特定事件上发送邮件,这就是代码的运行方式:

var vStSMTPServer = "http://127.0.0.1"
var vObCDOMsg = Server.CreateObject("CDO.Message"); 
var vObCDOConf = Server.CreateObject("CDO.Configuration");
var vObCDOFlds = vObCDOConf.Fields;

// Set the CDOSYS configuration fields to use port 25 on the SMTP server.
//With vObCDOFlds



//--these information are being retrieved from db:

vObCDOMsg.Configuration = vObCDOConf;
vObCDOMsg.To      = email;      
vObCDOMsg.From    = frmAddress; 
vObCDOMsg.Subject = subject ;               
vObCDOMsg.Bcc     = bcc

//--this is the body

var body= 
body = <link href='http://www.es.com/longh/pages/eventsStyle.css' rel='stylesheet'><style type='text/css'>td{font-family: Arial,Helvetica,Verdana,Geneva,sans-serif;font-size: 9pt;line-height: 14px;color: #313104;}</style></head><body><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td><br /></td></tr><tr><td align='center'><table width='600' cellspacing='0' cellpadding='0' border='0'><tr><td colspan='3' bgcolor='#CBBE92'></td></tr><tr><td rowspan='2' bgcolor='#CBBE92'></td><td><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td colspan='2' width='100%' height='50'><table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td width='100%' height='33'>&nbsp;</td><td rowspan='2' width='153'><img src='http://www.es.com/longh/images/EStit2.gif' width='153' height='50' border='0' alt=''></td></tr><tr><td width='100%' height='20' bgcolor='#000000' colspan='2'>&nbsp;</td></tr></table></td></tr><tr><td width='140' height='100' align='center' valign='middle' bgcolor='#000000'><img src='http://www.es.com/longh/images/logoHostsmall2.gif' width='179'height='127' border='0' alt=''></td><td width='460' bgcolor='#000000'><img src='http://www.es.com/longh/images/GSQ12.jpg' width='460' height='127' border='0' alt=''></td></tr><tr><td width='140' bgcolor='#000000'>&nbsp;</td><td bgcolor='#000000' height='18'><img src='http://www.es.com/longh/images/spacer.gif' width='1' height='18' border='0' alt=''></td></tr></table></td><td rowspan='2' bgcolor='#CBBE92'></td></tr></table></td></tr><tr><td align='center'><table width='776' cellspacing='0' cellpadding='0' border='0'><tr><td><table width='560' align='center' cellpadding='0' cellspacing='0' border='0'><tr><td><br />Dear " + salutation + "<h5>Marriott Events Preorder</h5></td></tr><tr><td style='text-align: justify;'>We are delighted that you will attend the <font color='#000000'>" + eventname + "</font>on <font color='#000000'>" + eventdate + "</font>.<br />&nbsp;<br />We would like to provide you with the opportunity to make beverage and special dietary arrangements prior to the event, and have created an online pre-order facility for your convenience.<br />&nbsp;<br /></td></tr><tr><td>You will need to use the <b>Username:</b> <font color='red'>" + username + "</font> and the <b>Password:</b> <font color='red'>" + password + "</font> to gain access.<br />&nbsp;<br />Please ensure that you complete your pre-order by <font color='#000000'>" + deadline + "</font>.<br />&nbsp;<br /><a href='http://www.es.com/longh/?username=" + username + "' style='text-decoration: underline;'>Please click here to Sign In.</a><br />&nbsp;<br /><i>In case the above link does not work you can copy this url( <b>www.es.com/longh/?username=" + username +"</b>) and paste in your browser</i><br />&nbsp;<br />Feel free to contact Private Hospitality  on 111111xxxxxx22 / 8122 if you have any questions.<br />&nbsp;<br />We are looking forward to seeing you,<br />&nbsp;<br />Kind Regards,<br />&nbsp;<br />Events Team<br /><b>Grosvenor House</b><br />&nbsp;<br /></td></tr></table></td></tr></table></td></tr></table></body>";
 vObCDOMsg.AutoGenerateTextBody =false;
                vObCDOMsg.HTMLBody=body;

After the mail is getting send, when the receiver clicks on the above link the url is getting redesigned and coming something like this: 邮件发送完毕后,当接收者单击上面的链接时,URL就会重新设计,并出现如下所示:

<a href="http://zixvpm.infosecpartners.co.uk/?a=2541&amp;m=&amp;n=&amp;s=a800000055267a&amp;u=http%3a%2f%2fwww.eventsummary.com%2flongh%2f%3fusername%3dhtest33%26utm_source%3d%26utm_medium%3demail%26utm_campaign%3dunspecified&amp;t=&amp;e=subratkumar.parichha%40gmail.com&amp;h=d6c5af2e" style="text-decoration:underline" target="_blank" data-saferedirecturl="***https://www.google.com/url?hl=en&amp;q=http://zixvpm.infosecpartners.co.uk/?a%3D2541%26m%3D%26n%3D%26s%3Da800000055267a%26u%3Dhttp%253a%252f%252fwww.eventsummary.com%252flongh%252f%253fusername%253dhtest33%2526utm_source%253d%2526utm_medium%253demail%2526utm_campaign%253dunspecified%26t%3D%26e%3Dsubratkumar.parichha%2540gmail.com%26h%3Dd6c5af2e&amp;source=gmail&amp;ust=1463542862806000&amp;usg=AFQjCNFk6t5OtTcmeIkJzpRDeSGlFTddSw"***>Please click here to Sign In.</a>

For 2 out of 10 users this section 每10位使用者中有2位

dunspecified%26t%3D%26e%3DMadeleine.Montgomery%2540sonyatv.com%

has some extra characters getting appended to the link and it is not working. 链接上附加了一些额外的字符,因此无法正常工作。 something like this: 像这样的东西:

dunspecified%26t%3D%26e%3Mad%0d%0a%20%0d%0a%20eleine.Montgomery%40sonyatv.com%

Here are the urls having issue: http://zixvpm.infosecpartners.co.uk/?a=2541&m=&n=&s=a400000019ae8f&u=http%3a%2f%2fwww.es.com%2flongh%2f%3fusername%3dontgomery42%26utm_source%3d%26utm_medium%3demail%26utm_campaign%3dunspecified&t=&e=Mad%0d%0a%20%0d%0a%20eleine.Montgomery%40sonyatv.com&h=b886b5d2 这是出现问题的网址:http: //zixvpm.infosecpartners.co.uk/?a=2541&m=&n=&s=a400000019ae8f&u= http% 3a%2f%2fwww.es.com%2flongh%2f%3fusername%3dontgomery42% 26utm_source%3D%26utm_medium%3demail%26utm_campaign%3dunspecified&T =&E =疯狂%0D 0A%%20%0D 0A%%20eleine.Montgomery%40sonyatv.com&H = b886b5d2

http://zixvpm.infosecpartners.co.uk/?a=2541&m=&n=&s=ba00000134a7c3&u=http%3a%2f%2fwww.es.com%2flongh%2f%3fusername%3deters82%26utm_source%3d%26utm_medium%3demail%26utm_campaign%3dunspecified&t=&e=karolin.peters%254!0nkf.ch&h=949d75bf http://zixvpm.infosecpartners.co.uk/?a=2541&m=&n=&s=ba00000134a7c3&u=http%3a%2f%2fwww.es.com%2flongh%2f%3fusername%3deters82%26utm_source%3d%26utm_medium%3demail %26utm_campaign%3dunspecified&T =&E = karolin.peters%254!0nkf.ch&H = 949d75bf

http://zixvpm.infosecpartners.co.uk/?a=2541&m=&n=&s=a60000000bf20e&u=http%3a%2f%2fwww.es.com%2flongh%2f%3fusername%3dargue32%26utm_source%3d%26utm_medium%3demail%26utm_campaign%3dunspecified&t=&e=vicki.dargue%40pla!cesforpeople.co.uk&h=8b1c26e4 http://zixvpm.infosecpartners.co.uk/?a=2541&m=&n=&s=a60000000bf20e&u=http%3a%2f%2fwww.es.com%2flongh%2f%3fusername%3dargue32%26utm_source%3d%26utm_medium%3demail %26utm_campaign%3dunspecified&T =&E = vicki.dargue%40pla!cesforpeople.co.uk&H = 8b1c26e4

Can some one share some thoughts on how this is behaving like this? 有人可以就这样的表现分享一些想法吗?

There are limits on maximum recommended line lengths sent in emails, some email clients add spaces and other characters if you go over these limits, I've had this happen in emails before when sending via ASP. 电子邮件中发送的最大建议行长有限制,如果超出这些限制,一些电子邮件客户端会添加空格和其他字符,在通过ASP发送之前,我已经在电子邮件中发生过这种情况。

Try splitting the long link onto a few lines, with a line break at each space so before style= and target= etc, and see if that helps. 尝试将长链接分成几行,在每个空格处换行,以便在style =和target =等之前,然后看看是否有帮助。

link ="<a href='long stuff here' " & vbCrLf _
& "style='some style' " & vbCrLf _
& "target='some target'> " & vbCrLf

instead of 代替

link = "<a href='long stuff here' style='some style' target='some target'>"

Ralph 拉尔夫

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM