1

I have a VPS with inmotion hosting, and i send a confirmation email, but the email it takes too mucho to send, how is the best way to estructure the html code when i send a mail, how can i boost the performance.

This is my code.

$subject = 'Mail activation';

$body = '
    <html>
        <head>
            <base target="_blank">
        </head> 
        <body>
            <table style="max-width:800px; margin:0 auto; font-family: Arial, Helvetica, sans-serif;" cellspacing="0" cellpadding="10">
                <thead style="border-bottom:1px solid #DDD;">
                    <tr>
                        <td align="center" style="border-bottom:1px solid #DDD;">
                            <img src="http://p.unid.com/img/logoSASENegro.png" alt="" height="45" width="150"/>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            Hi classmate
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Press the following link.
                        </td>
                    </tr>
                    <tr>
                        <td>
                            www.google.com
                        </td>
                    </tr>
                    <tr>
                        <td>
                            You data:
                        </td>
                    </tr>
                    <tr>
                        <td>
                            ID - <b>'.$ids.'</b><br/>
                            Password - <b>'.$pass.'</b><br/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Don't response this email.
                        </td>
                    </tr>
                </tbody>
            </table>
        </body>
    </html>
';

$headers = "MIME-Version: 1.0\r\n";
$headers .="Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: Contacto SASE <atencionsase@unid.mx>\r\n";

if(mail($emailC, $subject, $body, $headers))
danielbmz
  • 31
  • 1
  • 1
  • 8
  • Your syntax is faulty. Look at `Don't response this email`. Your string ends there. – Joshua Aug 12 '16 at 15:14
  • 1
    Performance is related to the server / MTA setup, not the code. (→ off topic). Consider a mail class and a proper SMTP relay however. – mario Aug 12 '16 at 15:16

1 Answers1

0

On some servers mail() sent emails really slow. Your issue is not related to message content, but it related to your hosting provider. As a possible solution, you can just switch your script to sending mail via different SMTP server (for example gmail: Send email using the GMail SMTP server from a PHP page).

Community
  • 1
  • 1
deniskoronets
  • 520
  • 3
  • 15