Monday, May 22, 2017

I want to add a link to swiftmailer body but it removes colon after http

Here is my code set_time_limit(0); $activation_code = str_random(50); User::where('username', Auth::user()->username)->update(['activation_code' => $activation_code]); // Configuration $smtpAddress = 'smtp.gmail.com'; $port = 465; $encryption = 'ssl'; $yourEmail = 'chuksdsilent@gmail.com'; $yourPassword = 'moneymatters';

            // Prepare transport
            $transport = \Swift_SmtpTransport::newInstance($smtpAddress, $port, $encryption)
                ->setUsername($yourEmail)
                ->setPassword($yourPassword);
            $mailer = \Swift_Mailer::newInstance($transport);

            // Send email
            $message = \Swift_Message::newInstance( 'Email Verification');

            $message->setFrom(['chuksdsilent@gmail.com' => 'Contact Vendors']);


            // If you want plain text instead, remove the second paramter of setBody
            $message->setBody(
                        '<!doctype html>
                        <html lang="en">
                            <head>
                                <meta charset="UTF-8">
                                <title>Document</title>
                                <link href="https://fonts.googleapis.com/css?family=Titillium+Web" rel="stylesheet">
                            </head>
                            <body>
                                <div style="/*background: #ecebff*/; ">
                                    <div style="margin: 0 auto; width: 60%;">
                                        <div class="info" style="margin-top: 40px;">
                                            <div style="font-family: \'Titillium Web\', sans-serif; background: #e09e0e; padding: 40px 0px 10px 20px; font-size: 20px; color: white;">
                                                Contact Vendors Verification Code
                                            </div>
                                            <div style="padding: 20px 20px; background: #f6f6f6;">
                                                <p>Dear Customer,</p>
                                                <p> Thanks for signing up with contact vendor.
                                                    This email address is being used to activate your  a contact vendor Account.
                                                    <br />
                                                Please click on the link below to activate your account</p>
                                                <p>
                                                    Yours Sincerely,</p> Contact Vendor Team <p style="margin-top:40px;">
                                                    <a href="http://'.$url.'/vendors/public/email/verify/'.$activation_code.'?'. str_random(100).'" style=" padding: 10px 30px; background: #e09e0e; color: white; text-decoration: none;">
                                                   Click here
                                                    </a>
                                                </p>
                                            </div>

                                        </div>
                                    </div>
                                </div>
                            </body>
                        </html>', 'text/html');

             $to = array('oshabasam@gmail.com' => 'sam');

            if (is_int($to)) {
                $message->setTo($to);
            } else {
                $message->setTo($to);
            }
            $mailer->send($message);

Thanks for your reply



via Oshaba Chukwudi

Advertisement