emails are coming with 20 min delay bluehost

853 Views Asked by At

Here is my php code:

$message = '
        <div style="width:600px;background:white;padding:25px;">
        <div style="width:100%;font-size:25px;"></div>  
        <br/>  
                    <div style="width:100%;display:block;color:#666666;">Hello and welcome!</div><br/><br/>
                    <div style="width:100%;display:block;color:#666666;">My Message</div><br/><br/>
                    <div style="width:100%;display:block;color:#666666;">My Message 1</div><br/><br/>
                    <div style="width:100%;display:block;color:#666666;">My Message 2</div><br/><br/>;
                $header = 'From: Company | <[email protected]>' . "\r\n"; 
                $header .= "MIME-Version: 1.0" . "\r\n";
                $header .= "Content-type:text/html;charset=utf-8" . "\r\n"; 
                $from  = '<[email protected]>'; 
                $subject =  'Thank You';
                $joinmail = $_POST['joinmail'];
                global $wpdb;   
                 $checkUserEmail = $wpdb->get_results("SELECT * FROM club_members WHERE Email = '".$joinmail."'");  
                $ip = $_POST['ip'];
                $to = '';
        $to .= $joinmail; 
                if(empty($checkUserEmail)){ 
                        if(mail($to, $subject, $message, $header)) {
                            global $wpdb;
                            $wpdb->insert(
                                    'club_members',
                                    array(
                                        'Email' => $joinmail,
                                        'IP' => $ip, 
                                        'Date' => current_time('M/Y/d H:i:s')
                                    ),
                                    array( 
                                            '%s', 
                                            '%s',
                                            '%s'
                                    )
                            );
                        }
                }

I am using this code to send email from Wordpress website. My hosting is bluehost. Before migrating site to bluehost it was on hostgator and everything was Ok, no such delay. On bluehost I can receive emails without any delay but when am sending from this email address receipient receives with 20min delay.

0

There are 0 best solutions below