Have you an idea to send email in new way?

✔ Recommended Answer

First file q1.php and code for that

<?php $con = mysqli_connect('localhost','root','','test');  ?>   <form action='emailScript.php' method='post'>        <div class="control-group">         <label class="control-label" for="basicinput"> Select Users ID</label>          <div class="controls">     <select name="category[]" id="id" class="span8 tip mdb-select colorful-select dropdown-primary" multiple searchable="Search here.." required>         <option value=""disabled>Select User Credentials</option>         <?php $sql=mysqli_query($con,"select * from Users where Status='1'");         while ($rw=mysqli_fetch_array($sql)) { ?>             <option value="<?php echo htmlentities($rw['Email']);?>">                <?php echo htmlentities($rw['Full_Name']);?>                                    </option> <?php } ?>       </select>       </div>     <textarea name='emailText'></textarea>      </div>    <input type='submit' name='submit' value='Send' />      </form>

Second file emailScript.php code is below

<?php        //check values are coming here or not     echo '<pre>';         print_r($_POST);      echo '</pre>';      $emails = $_POST['category'];      $emailText = $_POST['emailText'];      foreach($emails as $email){        //if email sending funciton is set properly then mail will fly        //:)         if( mail("$email",'Subject of Email',"$emailText")){              echo 'Mail Send Successfully';           }else{           echo 'ERROR:';         }      }     ?>

I hope at least now you come up with good news. :)

I am using xampp with mercury mail server so local meail is sended properly.

enter image description here

enter image description here

Try This with PHPMailer Class

<?php //check values are coming here or not echo '<pre>';     print_r($_POST);  echo '</pre>';              include_once "PHPMailer/src/PHPMailer.php";                        $emails = $_POST['category'];            $mail = new PHPMailer();            $mail->setFrom('hello@codingpassiveincome.com');            $mail->Subject = "Please verify email!";            $mail->isHTML(true);            $mail->Body = $_POST['emailText'];                        foreach($emails as $email){                                $mail->addAddress( $email );                                if ($mail->send())                    $msg = "You have been sent your email!";                else                    $msg = "Something wrong happened! Please try again!";            }  ?>  <?php if ($msg != "") echo $msg . "<br><br>" ?>  <?php if ($msg != "") echo $msg . "<br><br>" ?>

Source: stackoverflow.com

Answered By: Er. Amit Joshi

Method #2

There are several new ways to send emails that have emerged in recent years. Here are a few examples:

  1. AMP for Email: AMP (Accelerated Mobile Pages) is an open-source HTML framework that allows for interactive content in emails. With AMP for Email, you can create interactive and dynamic emails that allow users to complete actions without leaving their email client.

  2. Chat-based email: Chat-based email is a new way to send emails that feels more like a conversation than a traditional email. Instead of composing a message in a separate window, users can send and receive emails within a chat interface. This makes it easier to keep track of conversations and respond quickly.

  3. Voice-based email: Voice-based email allows users to send and receive emails using voice commands. This is particularly useful for people who are visually impaired or have difficulty typing.

  4. Email scheduling: Many email clients now allow users to schedule when an email will be sent. This can be useful for ensuring that emails are sent at the most appropriate time and to avoid sending emails outside of business hours.

  5. Personalization: With advances in machine learning and AI, it's now possible to send highly personalized emails that are tailored to the recipient's interests and preferences. This can help to increase engagement and improve the effectiveness of email marketing campaigns.

These are just a few examples of the new ways that email is evolving. As technology continues to advance, we can expect to see even more innovations in email communication.


Most Popular

PhpStorm, return value is expected to be 'A', 'object' returned

Remove Unicode Zero Width Space PHP

Laravel file upload returns forbidden 403, file permission is 700 not 755