Thank you for your patience. I have looked at numerous forums to no avail.
I have a simple form html/php, for visitors to send questions.
The form is on page 1, which submits to page to, echoes the form and then redirects to index.php. The form picks up the data, and posts it on page 2 , but no email arrives in the inbox nor junk box. I whittled everything on page 2 back to - // Send the mail
-
-
$to = "tenders@example.com";
-
$subject = "Enquiry form submitted " . date("F j, Y, g:i a");
-
-
$fromaddress = "enquiryform@example.com";
-
-
mail($to, $subject, $message);
, with still no luck. I have asked my web host but they refuse to assist. Can the problem be within the php.ini file??
The form sends the data from page 1 to page 2 where it is echoed, but nothing arrives in the mail box and no error messages appear.
Many Thanks in advance
11 2970 Atli 5,058
Expert 4TB
Do you have the error messages turned on?
My first guess would be that this is because you do not specify the From header. It needs to be specified for the mail function to work, either in the PHP config or using it's fourth parameter.
See the second example in the manual entry for the mail function. Try to add something similar to your code and see if that works.
Atli, yes thanks, I have tried that, no difference.
My gut feeling is that the php.ini file is stopping the send mail, and I can't edit this, nor get the webhost to edit it either.
Atli 5,058
Expert 4TB
Ok. If you have no power to alter the config, and the mail function doesn't seem to be configured properly, you could try to use one of the mailer classes. Both PHPMailer and Swift Mailer have worked well for me in the past.
With them, even if your server does not provide a sendmail or SMTP server, you can have them use an external program. They can even be made to use the Gmail SMTP server. (Be careful though. Gmail is not meant for mass-mailing.)
Thanks Atli, I tried both of those, obviously didn't do it right coz neither of them worked. I think fu*k it, people can ring us, the numbers on the page.
hey man...
i know this may seem too simple but the problem is usually obvious...
do you have a database program like... wamp...
No, we do not have a database, we just use the form for potential clients to send us requests.
After further deliberation I find that my form can send to another email address but with no senders address, just 'anonymous' which is why the server blocked it. However, no matter what I try I cannot get the senders email address to show up AND have the email html formatted at the same time.
Suggestions??
here is the snippet... -
// Email Layout
-
-
$message='<html>';
-
$message.='<head>';
-
$message.='<title>Enquiry form</title>';
-
$message.='</head>';
-
$message.='<body>';
-
$message.=$messagebody ;
-
$message.='</body></html>';
-
-
-
-
-
// Send the mail
-
-
$Name = "Mike Lomman"; //senders name
-
$email = "mikelomman@hotmail.com"; //senders e-mail address
-
$recipient = "tenders@russco.com.au"; //recipient
-
$mail_body= $message ;//mail body
-
$subject = "Test Test Test"; //subject
-
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
-
-
ini_set("sendmail_from", "enquiryform@russco.com.au"); //Suggested by "Some Guy"
-
-
-
//$header = 'MIME-Version: 1.0' . "\r\n";
-
//$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
-
//$header.='Reply-To: tenders@russco.com.au' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
-
-
-
-
mail($recipient, $subject, $mail_body, $header); //mail command :)
-
-
Atli 5,058
Expert 4TB
In that code, all you should need to do is uncomment the content-type and mime-version headers, to have the message sent as HTML. - Make sure you add the period before the = on line #26, or it will overwrite the From header, rather than add to it.
P.S.
You don't need to set the sendmail_from directive (line #23) if you supply the From header in the mail function itself.
Thanks again Atli,
I still can not get the form to send an email to my work primary email address. It will however send to my secondary gmail and hotmail accounts, with the html formatted correctly and a senders name and email showing. I can even get it to send with my work email address as the senders address and still nothing. I feel that maybe there is some anti spam on the server stopping it coming through.
Atli 5,058
Expert 4TB
Yea. If the email is getting through to one of your accounts but not another, the code is not to blame. There is most likely an anti-spam feature blocking it.
Update on my form concern.
I have moved the page, "thanks for your submission" to another server and this now works as advertised. I guess that there was an issue with the spam settings, something that the provider refused to look into.
Now all I need is to validate the input and secure the input from spammers.
Thanks for all your efforts in assistance.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Marc |
last post by:
Hello,
I have a self - submitting form with multiple submits and I want to
detect after the submit which button is pressed.
Code example:
<form name="example" method="post"...
|
by: Roger Price |
last post by:
Thank you to Yang (Is that your first name?) and Andy for your suggestions.
I am 99% of the way there but now cannot get the "Reset" button to work.
I have included the whole of my code and...
|
by: rjames.clarke |
last post by:
I have the following.
$result=mysql_query($sql);
$nrows=mysql_num_rows($result);
for ($i=0;$i<$nrows;$i++)
{
$row_array=mysql_fetch_row($result);
echo "<form name='testform'...
|
by: Sithlord999 |
last post by:
Hello.
I'm working on an email form on Dreamweaver and I'm looking for a PHP code to make it work. The form with some required fields would send the submitted information and two image attachments...
|
by: sameergn |
last post by:
Hi,
I have an image in my HTML form which has onclick() handler. There is
also a submit button and a text box.
Whenever text box has focus and user presses enter, the onclick() event
of...
|
by: Spycat |
last post by:
Hi all and happy holidays!
I should start off by stating I am NOT a PHP programmer.
I say that so that in any response to me, you will speak very s-l-o-w-l-y or I won't know what you're talking...
|
by: ak1dnar |
last post by:
Hi, I got this scripts from this URL
There is Error when i submit the form.
Line: 54
Error: 'document.getElementbyID(....)' is null or not an object
What is this error.
Complete Files
|
by: Jerim79 |
last post by:
I need to create a form that takes a number that the user enters, and
duplicates a question the number of times the user entered. For
instance, if the customer enters 5 on the first page, when...
|
by: plumba |
last post by:
Hi all
I have a form (see below), which for some reason has decided to stop functioning all together. It just does not call up the function. It is called up in the opening <form> tag but...
|
by: colt28 |
last post by:
Ok so I found an ajax contact form script but i can't get the b****** to work. I made a bunch of alterations to it and it didn't work so i replaced everything with the original and it still didn't...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |