This is my code and i have done everything to make it work but i am stuck. I can't get this code to sent email out ..
<?php
if(isset($_REQUEST['submit']))
{
$to = "usman_86#rocketmail.com";
$subject = "Find Dealer # flowsleeve";
$headers = "From: Find Dealer ";
$headers .= "Reply-To: ". strip_tags("usman_86#rocketmail.com") . "\r\n";
$headers = 'MIME-Version: 1.0' . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$messsage = "
Name : ".$_REQUEST['first_name']."
Email : ".$_REQUEST['email']."
Event Type : ".$_REQUEST['event_type']."
Event location : ".$_REQUEST['event_location']."
Last Name : ".$_REQUEST['last_name']."
Home Phone : ".$_REQUEST['home_phone']."
Event Date : ".$_REQUEST['event_date']."
Referrer : ".$_REQUEST['referrer']."
Message : ".$_REQUEST['message']."";
mail($to,$subject,$message,$headers);
The problem is in header section. You forgot to add . in line 8. Take a look at this and correct it.
$headers = "From: Find Dealer ";
$headers .= "Reply-To: ". strip_tags("usman_86#rocketmail.com") . "\r\n";
$headers .= 'MIME-Version: 1.0' . PHP_EOL;
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
Because of this mistake, header will contain only mime version info, content type and charset.
I tried your code, without the if ( isset .. statement.
Your code works successfully. Please add additional code or errors.
Make sure you also check your spamfolder.
Related
My PHP mail() script changes the ! exclamation mark on some email clients such as hotmail to %21 when the ! is in a tag in the email body.
Here's my script
$to = "myemail#outlook.com";
$subject = "Password Reset";
$body = "Link 1
<br><br>
Without href: http://example.com/#!/page - regular text
";
$headers = "From: no-reply#example.com\r\n";
$headers .= "Reply-To: no-reply#example.com\r\n";
$headers .= "Return-Path: no-reply#example.com\r\n";
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($to,$subject,$body,$headers);
So in the script above, the ! is changed to %21 only when it's a link, the regular text keeps it as /#!/instead of transforming it to /#%21/
How would I go about fixing this issue so it doesn't change to %21?
Some characters are encoded because they are not valid URLs. In your case URL code points are replaced with percent-encoded byte %.
I am defining my php headers like so:
$sitename = 'My Site';<--Getting Site Name Dynamically So It Must be a variable-->
$headers = "From: " . $sitename . "\r\n";
$headers .= "Reply-To: ". $sitename ."\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= "Content-type: text/html; charset=$get_charset" . "\r\n";
$headers .= "X-Mailer: PHP/".phpversion();
On yahoo mail it works and my site name displayed properly but inside Gmail it shows as "unknown sender". So how can I show my site name inside Gmail?
Thanks.
Add an email address, that's what the fields 'From' and 'Reply-To' are for:
$sitename = 'My Site <info#mysite.com>';
Ok before you guys laugh LOLZ --> I'm not sure if this is a GMAIL issue or something I'm doing wrong but im trying to insert an email for an activation link in the body of a message.
$body = "Or click on this link: Activate Your Account "
Ok the problem here is that my GMAIL account shows this: (which BTW is click-able and routes correctly)
Or click on this link: <a href="http://www.url.com/start/page.php?verify=true&id=f22645cff5ecfd4d3c115af5&activate=75845> Activate Your Account </a>
What am I missing here? Is this just a gmail issue? How can i Correct this?
I want it to show: Activate Your Account
Try closing the quote at the end of your URL.
The SO syntax highlighting even showed you the issue.
Wrong Syntax,
error hould have showed you whats happening,
Parse error: syntax error, unexpected T_STRING on line x...
2 . Send HTML mail, the Content-type header must be set to html
I made some changes and tested this, try this working script :
<?php
$body = 'Or click on this link: Activate Your Account ';
// To send HTML mail, the Content-type header must be set
$headers = 'From: webmaster#example.com' . "\r\n" .
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail("to#gmail.com","Subject goes here",$body,$headers);
?>
PHP Mail
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
For sure you're missing a double quote here.
<a href="http://www.example.com/...5845>
This shall be instead written as:
<a href="http://www.example.com/...5845">
If you didn't set the headers, this works for me. Of course you need to set your own variables.
$sender_email = strip_tags($sender_email);
$subject = "=?UTF-8?B?".base64_encode(strip_tags($title))."?=";
$message = nl2br(strip_tags($message));
$headers = "From: ".$sender_email.' <'.$sender_email.'>'."\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html;\r\n";
$headers .= "\tformat=flowed;\r\n";
$headers .= "\tcharset=\"utf-8\";\r\n";
$headers .= "\treply-type=original\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "Reply-To: ".$sender_email."\r\n";
$body = __('sendfriend:defaultmessage') . '<br /><br/>'.$link.'<br/><br />'.$message;
$mail = mail($recipients, $subject, $body, $headers);
Make sure to send the email as an HTML email.
$headers = "From: myEmail#example.com\r\n";
$headers .= "Content-Type: text/html\r\n";
mail(...$headers);
Add the $headers variable on the end of the mail function.
define headers in your mail function first
$headers = 'From: abc#example.com' . "\r\n" .
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
I am trying to dynamically send text messages using a PHP script. PHP code:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$textbody=<<<_MESSAGE_
Some text
_MESSAGE_;
mail('myphonenumber#SMSgateway','subject',$textbody,$headers);
I did receive a text message, but it is a "photo message" or rather multimedia instead of text and I am unable to open the message. I have tried playing around with the encoding and $textbody="this text"; instead of *MESSAGE*.
a) How can I send a normal text message (not multimedia)?
b) Why can't I open it?
c) Is there a way for people to respond to the texts I send with text? When I sent myself a text from hotmail I was able to reply and I got the answer in my inbox. When I tried to put $header.= 'From: me <me#somedomain.com>' . "\r\n"; the email wouldn't send
(reason: 553 sorry, your mail was
administratively denied. (#5.7.1))
Thanks!
$sendTo = "test#test.com";
$subject = trim($_POST['subj']);
$headers = "From: ".$_POST['name']."<" . trim($_POST["email"]) .">\r\n";
$headers .= "Reply-To: " . trim($_POST["email"]) . "\r\n";
$headers .= "Return-path: " . trim($_POST["email"]);
$headers .= "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$message = strip_tags($_POST["messg"]);
if (#mail($sendTo, $subject, $message, $headers))
{ echo "sent successfully"; }
else
{ echo "Error ... Plz try again later" ; }
This code which I'm using to send emails
I worked before on SMS project so if you have any question about how to link with Getaway feel free to contact me
I have a site in PHP.In this when I send the invitation to people it takes the from address as mysitename#servername.Instead of this I want o display the Mysitename
.How can I do.I have the code shown below.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To:'. $value . "\r\n";
$headers .= 'From:Mysitename'."\r\n";
How can I show like in users email's from address is Mysitename?
Thanks in advance?
$headers .= 'From: Mysitename <mysitename.com>' . "\r\n";
http://php.net/manual/en/function.mail.php
Maybe something along the lines of:
$headers .= 'From: Mysitename <owner#mysitename.com>' . "\r\n";
You need 'From' to be proper email address.