Page 1 of 1

Basic PHP email question

Posted: Fri Feb 11, 2005 6:14 am
by ave
I have a flash web site on easyspace servers, it has an e-mail form which works ok elsewhere but wont work on their servers as they say it needs different code to work.
The base code is as follows

Code: Select all

<?php
mail("me@myemail.com", $subject, $message, "From: PHPMailer\nReply-To: $from\nX-Mailer: PHP/" . phpversion());
?>
However on easyspace it says the following....
Using PHP with easymail
As you can see from the installation we have PHP setup to use our easymail system on the webserver.
You still use the mail() function but you need to send a "From" header including a valid email address.
EG.
mail ( "someone@somedomain.com" , "subject" , "message" , "From: server@easyspace.com" );
so i changed my code to read as above and it still didnt work ??

Please any help on this will be greatly appreciated as ive asked easyspace helpdesk 5 days ago !! and still no reply
(as you may have guessed im not exactly very good with PHP so forgive the stupidness of this question)

Posted: Fri Feb 11, 2005 7:13 am
by AGISB
You might want to consider using an external mail function like phpmailer.

Posted: Fri Feb 11, 2005 7:13 am
by Maugrim_The_Reaper
phpmailer, it's a simple mailing class that let's you create a setup script for all the values and then send the email.

http://phpmailer.sourceforge.net/

Might also try a less generic from email - in case it's been screened.

Posted: Fri Feb 11, 2005 8:16 am
by ave
so is there no way to get my original simple script working ?
I mean it works fine on my other site...

I am not very good at PHP and also i have to integrate it into a FLASH form... hmm this is a problem, thanks for the help so far though ill certainly look at the link you posted.

Posted: Fri Feb 11, 2005 8:26 am
by d3ad1ysp0rk

Code: Select all

<?php
mail("me@myemail.com", $subject, $message, "From: PHPMailer@mysite.com\nReply-To: $from\nX-Mailer: PHP/" . phpversion());
?>
Did you read the error..?
It told you what to do.

Also, where is $from coming from? If it's YOUR email, thats what you should be using.. (not PHPMailer).

Posted: Fri Feb 11, 2005 11:27 am
by ave
ok not to sound ungrateful but one thing ?
What error ??

And ok the problem is i am translating dynamic text fields in FLASH to an e-mail format.
Im also not sure i understand what you meant here
Also, where is $from coming from? If it's YOUR email, thats what you should be using.. (not PHPMailer).
To clarify i have now tried altering the code as you suggested, and as easyspace suggested and ive even removed this part

Code: Select all

\nReply-To: $from\nX-Mailer: PHP/
so it functions normally and it still doesnt work, things is it works fine as it had it set up originally but on easyspace servers it just wont have it

Posted: Fri Feb 11, 2005 11:30 am
by feyd
talk to their support then.

Posted: Fri Feb 11, 2005 12:47 pm
by d3ad1ysp0rk
ave wrote:ok not to sound ungrateful but one thing ?
What error ??
Using PHP with easymail
As you can see from the installation we have PHP setup to use our easymail system on the webserver.
You still use the mail() function but you need to send a "From" header including a valid email address.
EG.
mail ( "someone@somedomain.com" , "subject" , "message" , "From: server@easyspace.com" );
It's tell you, that you need your email in the correct format, user@domain.com, and you put "PHPMailer" which isn't in that form.
And ok the problem is i am translating dynamic text fields in FLASH to an e-mail format.
Im also not sure i understand what you meant here
Also, where is $from coming from? If it's YOUR email, thats what you should be using.. (not PHPMailer).
To clarify i have now tried altering the code as you suggested, and as easyspace suggested and ive even removed this part

Code: Select all

\nReply-To: $from\nX-Mailer: PHP/
so it functions normally and it still doesnt work, things is it works fine as it had it set up originally but on easyspace servers it just wont have it
What does your code look like now?

And what I meant was, how is the $from variable set? or where?

Posted: Sat Feb 12, 2005 8:31 am
by ave
feyd wrote:talk to their support then.
i have and its taken 6 days and NO response as i said originally was hoping some one might have had the same problem already.

In reply to 'LiLpunkSkateR'

The $from is defined by a text field in the flash movie and basically it add a 'REPLY TO' field to the e-mail telling you who sent it and allowing you to reply.
So to clarify as this has all got rather confusing (for me anyway lol)
My code now looks like this....

Code: Select all

<?php 
mail("me@myemail.com", $subject, $message, "From: User@domain.com\nReply-To: $from\nX-Mailer: PHP/" . phpversion()); 
?>
And it still doesnt work...?
wierd very wierd, or maybe im just being thick, which believe me wouldnt be the first time :)

Posted: Sat Feb 12, 2005 9:51 am
by d3ad1ysp0rk
Hmm.. maybe try your actual email? Could be they have a strict anti spam policy and anything with domain.com is caught as well?

Posted: Sat Feb 12, 2005 10:01 am
by ave
Have tried that already, its most peculiar...
(Where ever i wrote generic comments like 'me@mydomain.com' i actually put the real adress's in)
But no joy still...

Posted: Sat Feb 12, 2005 10:05 am
by feyd
what about their strict format they show in their example? If that works, then slowly poke out of that checking each one to see if it's blocked. After you run through all the options you wanted to use, you should have a map of all that are valid/allowed and that aren't.. may also want to try \r\n instead of \n

Posted: Sat Feb 12, 2005 10:16 am
by d3ad1ysp0rk
feyd wrote:what about their strict format they show in their example? If that works, then slowly poke out of that checking each one to see if it's blocked. After you run through all the options you wanted to use, you should have a map of all that are valid/allowed and that aren't.. may also want to try \<span style='color:blue' title='ignorance is bliss'>are</span>\n instead of \n
haha, feyds filtering comes to bite him in the ass ;)

Posted: Sun Feb 13, 2005 6:40 am
by ave
thanks for the continued help everyone, still havent sorted it but ill try 'feyd's' suggestion tomorrow, i think thats the only option i have left aside from trying a totally different approach.