Let me start by saying I do not have a lot of programming knowledge. I use a program called PHPRunner to generate most of the php that I do. It is mainly for small office stuff nothing fancy.
My question is:
I have a table that has 6 fields one of them called email. When I go into a record I wanted to put a button called "send notification" that would email the record details to the email address associated with that record.
Any help would be greatly appreciated. I know it is probably out here on the web, possibly searching the wrong way.
You can use the mail function in php. Example from the provided link:
<?php
$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);
?>
For sending email using PHP, use mail() function
http://php.net/manual/en/function.mail.php
Example:
<?php
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$from = 'webmaster#example.com';
$headers = 'From: '.$from . "\r\n" .
'Reply-To: '.$from . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
Related
I've made a website with a mailing form, and the php to send it is as follows:
<?php
$to = "example#outlook.com";
$subject = $_POST["subject"];
$message = $_POST["message"];
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
It won't send anything.
Can anyone tell what's wrong in the script?
If it helps on anything, I'm trying to send to an Outlook email.
Thanks
I use this sample of code to send email from php
<?php
$to = 'nobody#example.com';
$subject = $_POST['subject']; //"the \test subject's";
$message = $_POST['body']; //'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
but when i recieve the email the subject displayed like that
the \\test subject's
How to remove this extra slash ?
Thanks
From http://php.net/manual/en/function.mail.php :
subject
Subject of the email to be sent.
Caution Subject must satisfy ยป RFC 2047.
RFC 2047 : http://www.faqs.org/rfcs/rfc2047.html
Wish it will help you.
I have a script that sends an email, but instead of the sender name being "admin#foo.bar", I want it to say "Foobar Admin". How can I do this?
Thanks!
Do you want something like this??
$email_from = $full_name.'<'.$email_from.'>';
try this
<?php
$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);
?>
for reference use http://www.php.net/manual/en/function.mail.php
Use this;
<?php
$to = 'to#mail.com';
$subject = 'Your subject';
$message = 'Your message';
$headers = 'From: Foobar Admin<admin#foo.bar>' . "\r\n" .
'Reply-To: admin#foo.bar' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
mail("recipient#aol.com","subject","message","From:Foobar Admin<foobar#admin.com>");
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);
When I send a message with PHP the recipients gets a from address such as this one:
user123#p3nlhg147.shr.prod.phx3.secureserver.net
How can I use my custom email address like info#mydomain.com as sender address?
Part of the mail function is the ability to include headers.
You should send a From header, like so:
$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);
source: http://php.net/manual/en/function.mail.php
If you mean how to change the field From, use this snippet from the official doc:
<?php
$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);
?>