Using variables in a message

Hello to everyone,
How do I use a variable in a message when sending a bulk mail to members?

Sample:

What are you using to send emails out? Different systems have different ways of doing it.

PHPMailer

$bulk_message_content = $_POST['bulk_message_content'];

$mail->MsgHTML("".$bulk_message_content."");

Why not make the text editor be the body of your message, $message = text editors text

I do not know english
I don’t understand because I’m a beginner

Can someone help me?

$mail->MsgHTML($_POST['bulk_message_content']);

People are trying to help you, but you giving “I don’t understand” when simple explanations are given doesn’t help you either.

Since I don’t speak English, it’s a problem

Okay, I’il do that, no problem.

$mail->MsgHTML($_POST['bulk_message_content']);

How do I use a variable in a message?

That function sends the email. So whatever html content you want in the body of the email needs to go into that function.

No problem sending mail
No problem sending HTML mail
Here everything is working properly

Question:
How do I use a variable in a mail message?

I send mail with the editor below, no problem

You can replace texts within strings with a variaty of fundtions like str_replace or strtr, just look them up in the manual.

Message content:

Firma: {RESELLER_COMPANY}
Adı Soyadı: {USER_BAYI_ADI_SOYADI}
Bayi Email: {BAYI_FIRMA_EMAIL}
Kullanıcı Email: {USER_EMAIL}
Kullanıcı Adı: {USER_NAME}

   $icerik = array();
   
   while ($row = $users->fetch_assoc() ) {
   
   $icerik = array("reseller_company"=>$row['reseller_company'], "user_bayi_adi_soyadi"=>$row['user_bayi_adi_soyadi'], "bayi_firma_email"=>$row['bayi_firma_email'], "user_email"=>$row['user_email'], "user_name"=>$row['user_name']);

   }
   
      foreach($icerik as $key => $value){

          echo str_replace(array('{'.strtoupper($key).'}'), $value, $_POST['bulk_message_content']);
      } 

It works but every replacement message repeats
How should I do

I did this using code, Works perfectly

Sponsor our Newsletter | Privacy Policy | Terms of Service