[英]Sending multiple content email to one recipient in PHP
I had a problem where I want to send multiple content to only one recipient 我有一个问题,我只想向一个收件人发送多个内容
here is my code 这是我的代码
$stringx = explode(",",$_POST["row"]);
foreach($stringx as $mvalue)
{
$ids = explode("_",$mvalue);
$rowid = intval($ids[0]); // 0
$lakeid = intval($ids[1]); //5312
$sql = getDataArray("SELECT Type FROM DB WHERE LakeID=$lakeid ",$link);
$msg = $sql[2][0]["Type"];
$contents = " Type : $msg <br/>
";
}
sendemail("hamirul@mydomain.com", "Hamirul", "mydomain", "automailer@mydomain","Lake Link ",$contents,$link);
The problem is when I try to send email, it only send one '$content' . 问题是当我尝试发送电子邮件时,它仅发送一个'$ content'。 I want to send multiple content at once. 我想一次发送多个内容。 If I code like this, it will send 2 content but it will email me two(2) times. 如果我这样编写代码,它将发送2个内容,但会向我发送电子邮件两次(2)。
foreach($stringx as $mvalue)
{
$contents = "// something ";
sendemail($contents,$link);
}
I want to get 2 contents in one email. 我想在一封电子邮件中获得2个内容。
Use this inside loop 使用此内部循环
$contents .= "some value"; $ contents。=“某些价值”;
So, code should look like: 因此,代码应如下所示:
$contents = ""; $ contents =“”;
foreach($stringx as $mvalue) { foreach($ stringx as $ mvalue){
.....
$contents .= " Type : $msg <br/>
";
// Or,
$contents = $contents . " Type : $msg. <br/> ";
.....
} }
sendemail($contents,$link); sendemail($ contents,$ link);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.