How to hide server name when send email using php to gmail?
I test my code on hotmail it's not show server name , But when i test send mail to gmail why gmail show server name. How to remove it's
http://image.ohozaa.com/i/b2b/Jqx7Zg.png
$headers = 'From: NUMBERONE<admin#numberone.com>' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
How can i do?
I think you will find that the hostname is still there in hotmail (view email header/source). Gmail just chooses to make it visible for anti-spam/fraud reasons.
If you have reverse DNS setup for a static IP dedicated to your webserver you could resolve this.
Related
I've created a form to get information from end users and email to a specific person. I'd like for the form to also be emailed to the submitter. Everything works, except when I try to Bcc the submitter. If I add the line to Bcc, the email is not sent. If I delete the line to Bcc the email is sent correctly, but the submitter doesn't have a copy of the email. Here is the code,
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: $email' . "\r\n";
$headers .= 'Bcc: $email_bcc' . "\r\n";
Add the BCC Receiver to the recipients but NOT to the headers!
Using Bcc in the header should be fine. However, make sure, that your mail server is not killing the mail because of it.1
Check the return value of the mail function. This should return false, if an error occured. If that is the case, you should send an extra mail to the sender.
Windows Server seem to have a problem with this.
I have been sending an email to the user who signs up on my website. The email is correctly being sent to inbox folder in other services like gmail, yahoo but in case of hotmail sometimes it ends up in junk folder and sometimes it goes to inbox.
Below is my email code snippet from my registration code:
$user->save();
$activationUrl = Yii::app()->request->getBaseUrl(true) . '/site/activateaccount?activation_key=' . $activationKey;
$body = $this->renderPartial('accounts/registration_email', array('activationUrl' => $activationUrl), true);
$subject = 'Please complete your signup';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'From: Website Name<admin#mydomain.com>' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers.='Reply-To: admin#mydomain.com' . "\r\n";
$headers.='Return-Path: admin#mydomain.com\r\n';
if (mail($user->email, $subject, $body, $headers)) {
$this->redirect('registersuccess');
}
Please note that the email I send is HTML email and in above code I have replaced website domain with mydomain.com for privacy and website actual name with Website Name.
I have tried changing email subject line, MIME-version and content type.
Tried so many solutions already posted on SO here but no one makes it always go to inbox rather than junk.
My clinet has email account on hotmail so he wants that email to end up in inbox no matter what. Can something be done as sure shot solution? Does installing SSL on site domain solves this issue? Any other solution?
I got my mail script to work properly but I don't understand why PHP mail doesn't require me to enter the password for the from address.
Isn't it this dangerous? Couldn't someone use someone else's email to send inappropriate messages?
The mail script I used:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
mail($to, $subject, $message, $headers);
In other words: lets say if the I put your email address as the value of $from, that will send emails under your address.
Couldn't someone use someone else's email to send inappropriate messages?
Yes. If you check your spam filter, you'll see lots and lots of these - messages that appear to be from major companies, government institutions, etc.
The way to prevent this is not a password, but proper SPF and DKIM records in your domain name's DNS settings.
from address come with server extension, errror info#gmail.com via ecbiz132.hostername.com . how to solve this
$subject = "confirmation";
$from = "info#gmail.com";
$to = $email;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To:<'.$to.'>' . "\r\n";
$headers .= 'From: <'.$from.'>' . "\r\n";
$senad_replay = mail($to, $subject, $content, $headers, $from);
// errror info#gmail.com via ecbiz132.hostername.com . how to solve this
Yes, you can get rid the "via" part. Here's the details:
1) SPF and DKIM
Firstly, you would need to set an SPF record for the domain you are sending emails from and enable DKIM as well. These are primarily for identifying your messages against spam.
2) "From: anything#yourdomain.com"
Secondly, make sure you are setting the “From: ” header to be an email address on the domain you are sending messages from. Don’t pretend to be someone else. Use “From: someone#abc.com” if you are sending the messages from abc.com, rather than anything else, such as blah#def.com, or yours#gmail.com, or whatever. If you want the recipient to reply to your Gmail email instead of your domain email, use the “Reply-To: ” header. “From: ” must always be the domain email that you are sending the email from.
3) "Return-Path: return#yourdomain.com"
Thirdly and most importantly, set the “Return-Path: ” header to be the same domain as that of the “From: ” header. Use the 5th parameter of the mail() function for this:
mail('recipient#example.com', 'Subject', "Message Body", $headers, '-freturn#yourdomain.com')
So the Return-Path of this message would be “return#yourdomain.com” (the email address immediately following the -f switch). The $headers parameter should contain all the necessary message headers. Make sure “From: ” is something#yourdomain.com.
After these steps and measures, Gmail should now completely trust your messages from yourdomain.com. The ‘via‘ field of your messages should be gone and the ‘mailed-by‘ field as well as the ‘signed-by‘ field should be correctly showing up as yourdomain.com.
Hope it helps!
Why the mail function not sending mail to me ,Could any one please help me ?
Here i have wrote script to mail sending.
Is there any other settings to send mail.
But the mail function printing always "Success" , but the mail not received to me.
$Msg = "Your Suggestion is saved successfully. Please wait for admin approval";
$subject="New Suggestion Posted - Waiting for approval";
//$email_id = 'bajrang.lal#sunarctechnologies.com';
$email_id = 'bajrang.lal#sunarctechnologies.com';
$mail_msg="Hello Admin,<br><br>New Suggestion Posted. Waiting for approval.<br><br>
Suggestion : ".$frmdata['description']."<br><br> Click here for <a href='http://www.tatanykshipping.com/index.php'>login</a><br><br> Thanks,<br>The TATA NYK Team";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Tata NYK <".$_SESSION['EMAIL_ID'].">\r\n";
$headers .= "Organization: Tata NYK\r\n";
echo '<br>sending mail to = ',$email_id;
if(mail($email_id,$subject,$mail_msg,$headers))
echo '<br>Successs';
else
echo '<br>Fail';
Thanks a lot in advance.
If your PHP application is running on Linux and expecting to send mail from that system, you need a transport. I use sendmail, but there are other open source transports you can use. You may also have to install an email client, but I do not know how PHP interacts with sending mail. My applications act like an email client, and need the email client installed.
You also need to make sure that the email recipient will accept unsolicited port 25 traffic. Because of spam-ware, our firewall won't accept unsolicited port 25 traffic, so I have doctored up sendmail to log into our email server as a legitimate email account.