简体   繁体   English

phpmailer中的base64_encode

[英]base64_encode in phpmailer

I am trying to add the following hyperlink to an email. 我正在尝试将以下超链接添加到电子邮件中。 This link will direct a user to access a dynamic sales order. 该链接将指导用户访问动态销售订单。 It works when its listed on a webpage but not within an email. 它在网页上列出但不在电子邮件中列出时起作用。

This works when listed on my page: 这在我的页面上列出时有效:

$str = '[INVOICENO] =' . $OrderNumber . '';

echo ' <a href="http://n-server/nameofsoftware/PlatformRO/WebClient/NTLM/1/Integration?p=RLV&fc=de9766b2-4d43-4b93-b55d-0afac57bf79b&q=' . base64_encode ( $str ) . '">$OrderNumber</a> ';

Now i'm trying to send the same link within an email 现在,我正在尝试在电子邮件中发送相同的链接

$str = '[INVOICENO] =' . $OrderNumber . '';

$email_message = '
<a href="http://n-server/nameofsoftware/PlatformRO/WebClient/NTLM/1/Integration?p=RLV&fc=de9766b2-4d43-4b93-b55d-0afac57bf79b&q=' . base64_encode ( $str ) . '">$OrderNumber</a>


';

Is there an issue with using base64_encode within an email? 在电子邮件中使用base64_encode是否存在问题?

I tried to turn it into a variable and that still didnt work either. 我试图把它变成一个变量,但还是没有用。

Any ideas? 有任何想法吗?

Update: 更新:

The problem is the link is broken within an email. 问题是电子邮件中的链接已断开。

This is an example of the link when its echo'd on a webpage: 这是在网页上回显链接时的链接示例:

http://n-server/nameofsoftware/PlatformRO/WebClient/Client/Result?fc=de9766b2-4d43-4b93-b55d-0afac57bf79b&q=%5BINVOICENO%5D%20%3D3846411&displayOneDoc=False&orgId=1 http:// n-server / nameofsoftware / PlatformRO / WebClient / Client / Result?fc = de9766b2-4d43-4b93-b55d-0afac57bf79b&q =%5BINVOICENO%5D%20%3D3846411&displayOneDoc = False&orgId = 1

This is an example of the link when its within an email: 这是电子邮件中的链接示例:

http://n-server/nameofsoftware/PlatformRO/WebClient/Client/Result?fc=de9766b2-4d43-4b93-b55d-0afac57bf79b&q= 3846411&displayOneDoc=False&orgId=1 http:// n-server / nameofsoftware / PlatformRO / WebClient / Client / Result?fc = de9766b2-4d43-4b93-b55d-0afac57bf79b&q = 3846411&displayOneDoc = False&orgId = 1

尝试将urlencode和urldecode用作base64_encode值,因为在base64_encode中该值将为some =。

use urlencode php 使用urlencode php

This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to pass variables to the next page 编码要在URL的查询部分中使用的字符串时,此功能很方便,是将变量传递到下一页的便捷方法

urlencode(trim(base64_encode($str)))

UPDATE 1: 更新1:

<li> 
 <strong>View Order:</strong>

<a href='nserver2/nameofsoftware/PlatformRO/WebClient/NTLM/1/<?php echo urlencode(trim(base64_encode ("INVOICENO=". $OrderNumber))); ?>'> <?php echo $OrderNumber ?></a>

</li> 

UPDATE 2: 更新2:

    <?php

    $OrderNumber='123';  //ASSUMPTION

    $str = '[INVOICENO] ='.$OrderNumber;

    $final_string = urlencode(trim(base64_encode ($str))); 

    $email_message = '
    <a href="http://n-server/nameofsoftware/PlatformRO/WebClient/NTLM/1/Integration?p=RLV&fc=de9766b2-4d43-4b93-b55d-0afac57bf79b&q='.$final_string.' "> '.$OrderNumber.'</a>';

    ?>

    <li> <strong>View Order:</strong>
    <?php echo $email_message; ?>
    </li> 

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

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