/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Mail() in php script not mailing!

Hi

I have had a script running on my site for 3 months which has now apparently stopped working! Can anyone shed any light on the possibilities?

Without rehashing all of the code involved, this should work as follows:

Online entry form for a running race is written in html – standard form using various fields and checkboxes to complete. The relevant data is posted to php file1 which does a bit of parsing and error checking and if all the required fields have been completed, displays the entered data in a short table for the entrant to check.

If all is ok and the entrant clicks the button, the data is then posted to php file2 which processes the data into a mail message using a modified script based on chfeedback.php 2.04 which is a wizard generated feedback form (quite extensively modified). The entry details are then mailed to me in a comma separated format and the entrant is then linked to a payment page.

All has worked well (there has been an odd glitch but nothing major) for almost 3 months. The last successful mailing of the form data was on Wednesday 15th March. On the 16th there were 5 forms completed as evidenced by payments made but I didn’t receive any of them.

I’ve done various test forms myself and regererated a very short feedback form script to test and nothing comes through at all. There are no php error messages at any stage.

It appears to me that the problem probably lies with my hosting company due to the sudden cessation of mailing from the scripts coupled with the fact that entrants are successfully making it to the payment page. However, I can’t get them to accept this and they sasy that php is working fine on their severs (they have sent me their phpinfo() file output but it’s fairly meaningless to me)

Has anyone come across this sort of situation before? Is it symptomatic of a server/hosting error or some sort?

If it will help I can post the php file2 (the one that does the mailing) although it’s not very tidy as it’s my first efforts with php and, as I say, it’s based on a wizard produced script. Is there a method to post php code or just cut and paste into this box?

Any assistance greatly appreciated!! This is driving me mad. I’ve had to go back to an old cgi script to get the job done, but I can’t parse, error check or format the entry data using it as I didn’t write the script and I don’t understand the coding.

Many thanks for your time if you’ve managed to read this far!!

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@chazzyMar 17.2006 — Were there any changes to the SMTP server used for sending the mails? You might need to make sure you use proper headers in all of your mail requests.
Copy linkTweet thisAlerts:
@JSchofauthorMar 17.2006 — Should I know about changes to the smtp server? Sorry if I sound a bit dense on this!

This is the part of the script which pieces together the elements of the message and then mails it:

mail($mailto, $subject, $messageproper, "From: "$name" <$email>rnReply-To: "$name" <$email>rnX-Mailer: chfeedback.php 2.04" );

Does anything look intrinsically wrong with that?
Copy linkTweet thisAlerts:
@JSchofauthorMar 17.2006 — sorry - I guess I should have formatted the code this way (novice.....!)

[code=php]mail($mailto, $subject, $messageproper, "From: "$name" <$email>rnReply-To: "$name" <$email>rnX-Mailer: chfeedback.php 2.04" );[/code]
Copy linkTweet thisAlerts:
@chazzyMar 18.2006 — I can't tell you if it's right or wrong. It is correct. I have seen some cases where you need to pass it a 5th parameter, which would just be:

[code=php]
mail($mailto, $subject, $messageproper, "From: "$name" <$email>rnReply-To: "$name" <$email>rnX-Mailer: chfeedback.php 2.04","-f".$email);
[/code]


If that doesn't help you, you should contact your provider on this issue. They will tell you what needs to be passed in (and they'll probably be mad that you didn't already know).
Copy linkTweet thisAlerts:
@JSchofauthorMar 18.2006 — ok - thanks for that - I'll make some enquiries over the next couple of days in case they've tweaked something which I should have been aware of!!

Aren't computers wonderful things?!!
Copy linkTweet thisAlerts:
@JSchofauthorApr 04.2006 — Just to let you know that after 3 weeks of badgering my ISP they've finally admitted that they made some changes to their windows servers which stopped the mail() script from working!

It needed this code adding after the <?php declaration in case it's of any use for anyone else to try with a similar problem:

ini_set("sendmail_from", " [email][email protected][/email] ");

where you replace your own email address in the appropriate location.
×

Success!

Help @JSchof spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...