如何使用php自行发送带有XAMPP-Mercury Mail的电子邮件

I've been searching a lot, but can't really find what i exactly need.

Im running a shop-online using XAMPP, and what i want is send emails to the customers with their order but using a specific function.

What this fuction does, is to hide some characters (for security purpose) on the email sent to customers. So i've made the function (looking on internet), but i want to test it now.

This is my function (if it's wrong, i'd really appreciate some help):

<?php
 function xtc_hide_iban ($iban) {

$length = strlen($iban);
$lchars = substr($iban,0 ,5);
$rchars = substr($iban, -5);
$iban_hidden = $lchars.str_repeat('*',$length-10).$rchars;
return $iban_hidden;

}
?>

I think it's pretty obvious what i try to do, but i will still explain it:

Get the $iban from customers, and show only the first and last 5 characters when the email is sent e.G

Your IBAN is 'DE123************56789'

So, for now i can send emails from Mercury mail server to 'root@localhost',account i made on thunderbird, (it's the only account that worked for me, because any other with the same server, like 'anyname@localhost' didn't work or couldn't be created, and those who were create with imap before couldn't access to the inbox "could not connected to server, connection refuse", anyway this works with POP3)

Following what i looked before, is that somehow and somewhere i can put a *.php on Mercury folder so i will get a template of how to send the mails (headers, subject,body,etc).

My main question is how and where to do that? make a test php file to make sure my code is doing what i want to do

Thanks in advance

douhu4091
douhu4091 谢谢@RobinRijkeboer,我之前写过我的代码,但是在看过互联网上的其他一些例子后发生了变化,所以我感到很困惑。如果您发现任何其他错误,请告诉我
5 年多之前 回复
duandiao3961
duandiao3961 $lchars=$iban.substr(0,5);和$rchars=$iban.substr(-5);不会工作。它应该是$lchars=substr($iban,0,5);
5 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐