Welcome Guest, Not a member yet? Register   Sign In
Gmail giving warning when receiving email
#1

This thread contains two problems.

Problem #1

I have a page that sends an email. Problem is when I receive the email to a gmail account is get the following error:

Be careful with this message
Gmail could not verify that it actually came from [email protected]. Avoid clicking links, downloading attachments, or replying with personal information.

Obviously this is not going to work as the email contains a link to the customers invoice. 

Here is the code below. Any ideas how I can avoid this. 

PHP Code:
  public function boatsale_email($id) {
    $this->load->model'Customers_model' ); //loads model
    $data $this->Boatsale_model->get_boatsale_code($id);
    $data2 $this->Customers_model->get_cust_info_edit_bs$id );
    $bs_code $data->bs_code;
    $email $data2->email;
    $this->load->library('email');
    $this->email->from('[email protected]''Central Georgia Marina');
    $this->email->to($email);
    $this->email->reply_to('[email protected]''Central Georgia Marina');
    $this->email->set_alt_message('To view the message, please use an HTML compatible email viewer!');
    $this->email->subject('Your Central Georgia Boat Sale Invoice');
    $this->email->message('Please click ' base_url(). 'boatsale/boatsale_inv/' $bs_code ' to view and print your recent invoice');
    $this->email->send();
    redirect("boatsale/boatsale_print/$id");} 

Problem #2
The time it takes between the $this->email->send() and the redirect is 10-15 seconds. Seems kinda long. Any way to speed this up?

Thanks in advance for your help
Reply
#2

(This post was last modified: 07-10-2018, 11:48 PM by Pertti.)

Because the way emails work, the "From" field is free-form text inside the email, so you could say it's from Bill Gates and [email protected]. Luckily, each server that passes the email on adds it's own fingerprint in email headers, and it's common practice to check that the first server email was sent from actually matches the email address domain.

The warning in email suggests that your email SMTP config uses different email service/login than [email protected].

As for it being slow, it depends on what server/service you are using to send that email, but some services can get quite slow. There's some other things going on in that function, so you could check what causes the slow down:

PHP Code:
public function boatsale_email($id)
{
    echo 
'<pre>';
    echo 
date('H:i:s'), " Prep email\n";
    
$this->load->model'Customers_model' ); //loads model
    
$data $this->Boatsale_model->get_boatsale_code($id);
    
$data2 $this->Customers_model->get_cust_info_edit_bs$id );
    
$bs_code $data->bs_code;
    
$email $data2->email;
    
$this->load->library('email');
    
$this->email->from('[email protected]''Central Georgia Marina');
    
$this->email->to($email);
    
$this->email->reply_to('[email protected]''Central Georgia Marina');
    
$this->email->set_alt_message('To view the message, please use an HTML compatible email viewer!');
    
$this->email->subject('Your Central Georgia Boat Sale Invoice');
    
$this->email->message('Please click ' base_url(). 'boatsale/boatsale_inv/' $bs_code ' to view and print your recent invoice');
    echo 
date('H:i:s'), " Send email\n";
    
$this->email->send();
    echo 
date('H:i:s'), " Email sent\n";
    echo 
'</pre>';
    
// redirect("boatsale/boatsale_print/$id"); <-- comment out, redirect would get rid of the debug output

Reply




Theme © iAndrew 2016 - Forum software by © MyBB