0

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 | <test@domain.com>' . "\r\n"; 
                $header .= "MIME-Version: 1.0" . "\r\n";
                $header .= "Content-type:text/html;charset=utf-8" . "\r\n"; 
                $from  = '<contact@domain.com>'; 
                $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.

aiddev
  • 1,409
  • 2
  • 24
  • 56
  • Could be settings / restrictions set on the server by your host.. – Naruto Nov 23 '15 at 09:34
  • Where can I change that settings please ? @Naruto – aiddev Nov 23 '15 at 09:37
  • Probably going to have to mail/call your host asking tthem what the mailing settings are and ask them? If it's a server restriction, only they will be able to help you – Naruto Nov 23 '15 at 09:37
  • I asked them about this, they told me that it is server issue and will be fixed by itself, but it is already passed a month and no success. @Naruto – aiddev Nov 23 '15 at 09:41
  • 2
    @aidaghazaryan why did you not include this valuable information in your original post? Only your hoster can help you, call 'em again. this problem can not be solved by php. – maxhb Nov 23 '15 at 09:44

0 Answers0