When using the below code I am able to send (and receive) email to my Yahoo account, but when sending to my Gmail account, nothing shows up
(and yes, I have monitored the Spam folder for over 4hrs - nothing!).
public function sendEmail($email_addy, $temp_pass)
{
$website_name = $this->website_name;
$message = <<<MESSAGE
Greetings!
Your password is:
$temp_pass
Your friends at: $website_name !
MESSAGE;
$headers = 'From: ' . $this->email_from . "\r\n" . 'Reply-To: ' . $this->email_from . "\r\n" . 'X-Mailer: PHP/' . phpversion ();
mail ( $email_addy, $this->email_subject, $message, $headers );
}
Any ideas why Gmail just deletes the email? I thought that the message body text might be too small so I even added to the message with no different results...
Related
I have a script that sends data to a table in mysql database and now I've wanted to generate an email everytime someone adds new data. It works, but as you may know, it lasts almost 20-30 secs to complete and get the response.
I´ve read that exec function would have been good for executing mail() in a separate file, but at my shared server exec is disabled. Also are disabled these others:
symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Anybody can show how can I make this posible without blocking webpage until email is sent?
Thankyou!
the mail function looks like this. Is something in it making it slow??
$to = "xxx#gmail.com";
$subject = "xxxxx";
$message = "xxxxxxxxx: \n";
$message .= "\n";
$message .= " $getuser\n";
$message .= "\n";
$headers = 'From: xxxx#gmail.com' . "\r\n" .
'Reply-To: xxx#gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headerxs);
When I run this script to send an email, the email is being sent from serveradmin#myhosting. They say that the script isn't configured correctly.
I've changed the domain names and info shown below before posting here.
Is there really a problem with the scrip? The email sends, everything is fine.
It takes a bit long...don't know why, the only problem is it doesn't send from the domain I specified.
$to = $_POST['fes-email'];
$subject = 'TEST';
$body = 'TEST TEST';
$headers = 'From: NAME \(Info\) <name#domain.tld>' . "\r\n" .
'Reply-To: name#domain.tld' . "\r\n" .
'Return-Path: name#domain.tld' . "\r\n" .
'X-Priority: 1' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
mail($to, $subject, $body, $headers);
Try using quotes instead of escaping the parentheses:
$headers = 'From: "NAME (Info)" <name#domain.tld>' . "\r\n" .
You should remove the Return-path: header. This header is always recreated by the receiving server, using the envelope information sent via SMTP.
Have you tried putting just <name#domain.tld> in the headers for From?
I have a codeigniter with tank auth configured.I was doing all the test and everything was running properly on my development server.I shiftwd all my codes to the productiom server and no activation email of tank auth is being sent.I used gmail cobfiguration in the email vodeingiter config and email was sent but to some emails its not being sent.Why im i unable to sent email using the default codeigniter settinga in the production server.please help
In the function where you sending you data afte completion of task
$email = 'email on which you want to send mail';
$Subject = "Your subject message";
$smsg = null;
$smsg = 'yor message';
$email_from = 'manishatutorsbureau#gmail.com';
$header = 'From: ' . $email_from . "\r\n" .
'Reply-To: ' . $email_from . "\r\n" .
'X-Mailer: PHP/' . phpversion();
// Start code for sending mail
mail($email, $Subject, $smsg, $header);
For some odd reason if a user tries to send an email to themselves, the success function gets ran but the user never receives an email.
If $toAddress and $fromAddress are the same, user never receives the email. If they're different user does.
Have read a few questions on here, saying that if the email is on the same domain as the server it gets blocked for spam. But the users email isn't on the same domain as the server? Was testing this with my gmail account. Reply-to is not the email I'm actually using, it's just dumby text.
$to = $toAddress;
$subject = 'This is an email';
$message = $message;
$headers = 'From: '. $fromAddress . "\r\n" .
'Reply-To:do-not-reply#gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-Type: text/html; charset=UTF-8';
if(mail($to, $subject, $message, $headers)){
echo '{"status": "success", "senderAddress": "' . $_SERVER['REMOTE_ADDR'] . '", "content": "' . $_POST['toAddress'] . '"}';
} else {
echo '{"status": "fail", "toAddress": ' . $toAddress . '", "fromAddress": "' . $fromAddress . '"}';
}
Exclude the headers in the mail() function and try it. The headers are triggering GMail's filtering system. If a mail is sent from Gmail, there is a certain Domain-Key based authentication that verifies the identity of the senders.
you might need to Create a TXT DNS record containing this text:
v=spf1 include:_spf.google.com ~all
in your DNS server, to authorize your domain sending email.
Due to filtering systems withing Gmail and Hotmail, when using yourself as the receiver and the from it was going directly into spam within Gmail and Hotmail. With Gmail if the two values are different it would go into your inbox while hotmail will still count it as spam.
The title explains itself. It is a website for in-house employees to buy and sell from each other. Its based solely around Microsoft Outlook emailing addresses. All the emails are supposed to be sent from the seller's email as they post items. Except when I enter <php phpinfo(); ?> on the action php page it tells me that the sendmail_from attribute thing is sending from a bogus email on the server. It seems to be the automatic email for the php script to send from. This may be why the emails are getting sent to spam, because the email is not valid. Also, I read online about having full and valid headers but most headers seem optional and i cant find anywhere that explains optimal headers. My mailing code:
//send approval email to the approver
$from = isset($_POST['from'])? $_POST['from']:1;
$message = isset($_POST['message'])? $_POST['message']:1;
$message = $message . '<a href="http://dev-corkboard/newapproval.php?id='
.$result[0][0].'"> Click here to approve website post.</a>';
// In case any of our lines are larger than 70 characters, we should use
// wordwrap()
$message = wordwrap($message, 70);
$to = 'clehane#eatonvance.com';
$replyto = isset($_POST['replyto'])? $_POST['replyto']:1;
$subject = isset($_POST['subject'])? $_POST['subject']:1;
$headers = "MIME-Version: 1.0" . "\r\n" . 'From: "'.$from.'"' . "\r\n" .
'Reply-To: "'.$replyto.'"' . "\r\n" .
'Content-Type:text/html;charset=iso-8859-1' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $message, $headers)) {
//test message for email
}
header ("location: newindex.php"); `
Any ideas?
And bam! Solved it, needed to put email addresses as such:
$from = 'MyName <myemail#mycompany.com>';
And I also included these headers:
"X-Priority: 0\r\n".
"X-MSMail-Priority: Normal\r\n".
"X-Mailer: mycompany.com