I have been trying to send a php contact form, but it's not working at all.
my xampp use 8080 port.
I though that I have to change some configuration on php.ini or httpd.conf as well.
Please anybody help me.
Thank you.
this is the script:
<?php
$to = "tiya.vort4#gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse#example.com";
$headers = 'From: '.$from."\r\n".
'Reply-To: '.$from."\r\n" .
'X-Mailer: PHP/' . phpversion();
if(mail($to,$subject,$message,$headers)){
echo "Mail Sent.";
}
You would have to configure the mercury server bundled with xampp to actually deliver/relay the mails.
Related
This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 6 years ago.
I have a PHP simple code which supposed to send an email, but it seems it does not work since I have never received any mail.
Well I have a free free host and domain with CPanel that I have a Webmail feature there, I can send email through that to wherever I want (Yahoomail, Gmail, ..).
I really do not know how to solve it.
Here is my php code:
$to = 'sample#yahoo.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: sample#sample.com' . "\r\n" . 'Reply-To: sample#sample.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);`
My sendmail_path /usr/local/bin/phpsendmail, Path to sendmail /usr/local/bin/phpsendmail, SMTP localhost, smtp_port 25
Try this ...
$to = "somebody#example.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster#example.com" . "\r\n" .
"CC: somebodyelse#example.com";
mail($to,$subject,$txt,$headers);
I am facing e-mail sending problem.
e-mail does not send through my e-mail function.
My code is given below:
ini_set("sendmail_from",$_POST['email']);
$to = 'email#gmail.com';
$subject = $_POST['subject'];
$from = $_POST['email'];
$message = $_POST['message'];
$message = wordwrap($message, 70);
mail($to,$subject,$message,$from);
You have to setup your SMTP mail server and mention those details in php.ini before executing your script. For further info, please check http://www.phpeasystep.com/phptu/23.html
In your code you have to set proper header,
you have used $from for header section of mail.
change its value as
$from= 'From: '.$_POST['email']. "\r\n" .
'Reply-To: '.$_POST['email'] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
or you can use below solution.
Use PHPMailer API for sending mail. all are inbuilt there.
download complete code form below link
PHPMailer API
goodluck
I'm using iPage for my website, and I'm using a simple mail() method to send test mails from my page. On iPage, I have email capabilities via mark#domain.com. But when I send an email out, it comes from the iPage server and is sent from ipg.domain#boscustweb3506.eigbox.net, which is quite ugly looking!
Is there a way I can use the mail() method in php to send an email from my page that will use the shorter sender above? Thanks for any and all help!
you need to add a header named From. this code will send with the mail address webmaster#example.com:
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
Try this, You can add the From header to customise the sender address.
$from ='mark#domain.com';
$headers = 'From: ' . $from . "\r\n";
...
mail($to, $subject, $message, $headers);
I'm trying to use noreply to send out emails, but it doesn't work - it wont sent anything. I am using this test-file:
<?php
$to = 'myemailhere';
$subject = 'You received an email message!';
$message = 'This is a message in the email body form.';
$headers = 'From: noreply#example.com' . "\r\n" .
'Reply-To: noreply#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
What could be the problem? By the way, I am using rackspacke, if anyone should know about it.
Thanks in advance!
If you're running on a Rackspace cloud server, you will have to configure the server yourself to be able to send mail. The mail() function relies on the OS configuration to handle emailing. If you are on a Rackspace cloud site, you will likely need to contact Rackspace support for help.
Personally I dodge this bullet altogether by using PEAR's SMTP class. This is a full SMTP implementation in PHP and since it does not rely on any outside configuration or module, it is fully portable. It has saved me a LOT of trouble.
http://pear.php.net/package/Mail
http://pear.php.net/package/Net_SMTP
Note: The PEAR site is having some loading issues atm for me. Give it a minute and it should load.
what is exception? use try catch block. Else try this code
$to = "someone#example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse#example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
I have a contact page uploaded at this site. This URL is working properly, there are no errors or warnings except send mail function is not working.
When I test it in on our testing server it works properly, I can send and receive the mail.
Can you provide any assistance with this please?
$to = $_POST['email'];
$subject = $_POST['subject'];
$headers = 'From: info#mdpharma.se' . "\r\n" . 'Reply-To: info#mdpharma.se' . "\r\n" ;
$message =$_POST['message'];
$message = wordwrap($message, 70, "\r\n");
if($_POST['email']){
mail($to, $subject, $message,null,'-fwebmaster#example.com');
echo "Mail is successfully sent to you";
} else {
echo "Mail is not set to you";
}
you can take help from here http://phpmailer.worxware.com/index.php?pg=exampledb .
everything is well explained in here. best of luck.