PHP emailer

  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

Hi all
I have this php script
PHP Code: [ Select ]
 
<?php
 
$sendTo = "nucleo87@hot-no-spam-mail.com";
 
$subject = "Nucleo's Domain - Quota";
 
$business name = $_POST["business name"];
 
$description = $_POST["description"];
 
$colours = $_POST["colours"];
 
$number of variants = $_POST["number of variants"];
 
$instructions = $_POST["instructions"];
 
mail($sendTo, $subject, $business name, $description, $colours, $number of variants, $instructions);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $sendTo = "nucleo87@hot-no-spam-mail.com";
  5.  
  6. $subject = "Nucleo's Domain - Quota";
  7.  
  8. $business name = $_POST["business name"];
  9.  
  10. $description = $_POST["description"];
  11.  
  12. $colours = $_POST["colours"];
  13.  
  14. $number of variants = $_POST["number of variants"];
  15.  
  16. $instructions = $_POST["instructions"];
  17.  
  18. mail($sendTo, $subject, $business name, $description, $colours, $number of variants, $instructions);
  19.  
  20. ?>
  21.  
  22.  


and it is collecting the variables from my flash file
now i know the flash is correct, i followed a kirupa tutorial...
now it is this which i had to alter alot, and i dont receive any emails either..

any help would be greatly appreciated
  • Vidda
  • Beginner
  • Beginner
  • Vidda
  • Posts: 42

Post 3+ Months Ago

There are not so many variables in a Mail code, well as far as I know...
It's mail(reciever, subject, body, sender);
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

really?...
but, it is using the variables from a flash file....
  • Vidda
  • Beginner
  • Beginner
  • Vidda
  • Posts: 42

Post 3+ Months Ago

Yeah, but you still can't do that. You must put all those variables ($business name, $description, $colours, $number of variants, $instructions) in the message body.
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Yea, you should put something like this:
PHP Code: [ Select ]
<?php
 
$sendTo = "nucleo87@hot-no-spam-mail.com";
 
$subject = "Nucleo's Domain - Quota";
 
$message = "$_POST["business name"],
 
$_POST["description"],
 
$_POST["colours"],
 
$_POST["number of variants"],
 
$_POST["instructions"]";
 
mail($sendTo, $subject, $message, "Extra Header Information");
 
?>
  1. <?php
  2.  
  3. $sendTo = "nucleo87@hot-no-spam-mail.com";
  4.  
  5. $subject = "Nucleo's Domain - Quota";
  6.  
  7. $message = "$_POST["business name"],
  8.  
  9. $_POST["description"],
  10.  
  11. $_POST["colours"],
  12.  
  13. $_POST["number of variants"],
  14.  
  15. $_POST["instructions"]";
  16.  
  17. mail($sendTo, $subject, $message, "Extra Header Information");
  18.  
  19. ?>

That should work just fine, and for the Header information, you can put something like:
PHP Code: [ Select ]
."From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
 
     "Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n".
  1. ."From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
  2.  
  3.      "Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n".

Hope that'll work out for you.
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Yeah, you might wanna add some extra headers too... like create a message ID, and other things to make it more "legitimate". Some headers, and lack of some headers can cause spam filters to throw you in the junk :)

Btw, I edited both locations where your E-Mail address was at to stop the spam-spiders from adding you to more lists :)
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

thanks axe

thanks a bunch Scorpius, I will give it a go right away ;)
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

ok
now i am using this
PHP Code: [ Select ]
 
<?php
 
$sendTo = "inucleo@hot-not-so.com";
 
$subject = "My Flash site reply";
 
$message = $_POST["business name"],
 
$_POST["description"],
 
$_POST["colours"],
 
$_POST["number of variants"],
 
$_POST["instructions"];
 
 
 
mail($sendTo, $subject, $message);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $sendTo = "inucleo@hot-not-so.com";
  5.  
  6. $subject = "My Flash site reply";
  7.  
  8. $message = $_POST["business name"],
  9.  
  10. $_POST["description"],
  11.  
  12. $_POST["colours"],
  13.  
  14. $_POST["number of variants"],
  15.  
  16. $_POST["instructions"];
  17.  
  18.  
  19.  
  20. mail($sendTo, $subject, $message);
  21.  
  22. ?>
  23.  
  24.  


and i dont seem to be getting any emails now....
i just want it simple, so i receive the email, with the info i want.
im not fussed about spam filters
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Well, depending on where you are sending it to and from, it could be getting blocked. If you host your own server and are trying to send it from there, you can sometimes not send to some E-mail services. This is because of your ISP marking your IP as a residential IP and it will block some places, to stop some spammers. Also the $message variable should be:
PHP Code: [ Select ]
$message = "$_POST[business name],
 
$_POST[description],
 
$_POST[colours],
 
$_POST[number of variants],
 
$_POST[instructions]";
  1. $message = "$_POST[business name],
  2.  
  3. $_POST[description],
  4.  
  5. $_POST[colours],
  6.  
  7. $_POST[number of variants],
  8.  
  9. $_POST[instructions]";
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

ok, now i am using
PHP Code: [ Select ]
 
<?php
 
$sendTo = "inucleo@aaa.ashst.com";
 
$subject = "My Flash site reply";
 
$message = "$_POST[business name],
 
$_POST[description],
 
$_POST[colours],
 
$_POST[number of variants],
 
$_POST[instructions]";
 
 
 
mail($sendTo, $subject, $message);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $sendTo = "inucleo@aaa.ashst.com";
  5.  
  6. $subject = "My Flash site reply";
  7.  
  8. $message = "$_POST[business name],
  9.  
  10. $_POST[description],
  11.  
  12. $_POST[colours],
  13.  
  14. $_POST[number of variants],
  15.  
  16. $_POST[instructions]";
  17.  
  18.  
  19.  
  20. mail($sendTo, $subject, $message);
  21.  
  22. ?>
  23.  
  24.  


i tried it an nothing :banghead:

HELP! lol, any idea's at all

i have tried an hotmail account, my home account, my hosting account...
and still no email
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Try using . not commas...

like..

PHP Code: [ Select ]
 
<?php
 
$message = "You were sent an E-Mail from ".$_POST['business name']."\nDescription : ".$_POST['description']."\n";
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $message = "You were sent an E-Mail from ".$_POST['business name']."\nDescription : ".$_POST['description']."\n";
  5.  
  6. ?>
  7.  
  8.  

etc. etc...

You will need to use $_POST['variable_name']

The ' are probably going to be required, especially if the "name" value of your form fields are multiple words (this could be messing it up if they are. Convert the spaces to underscores. For example, "business name" becoming "business_name".
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Yea if you do have spaces, you will need the ', but I normally do not put spaces in any of my pages or forms, they always cause some sort of problem.
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

ok, i got it fixed by using this
PHP Code: [ Select ]
 
<?php
 
$sendTo = "nucleo87@badman.com";
 
$subject = "Nucleo's Domain - Quota reply";
 
 
 
$message = "$_POST[name],
 
$_POST[email],
 
$_POST[business_name],
 
$_POST[description],
 
$_POST[colours],
 
$_POST[number_of_variants],
 
$_POST[instructions]";
 
 
 
mail($sendTo, $subject, $message);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $sendTo = "nucleo87@badman.com";
  5.  
  6. $subject = "Nucleo's Domain - Quota reply";
  7.  
  8.  
  9.  
  10. $message = "$_POST[name],
  11.  
  12. $_POST[email],
  13.  
  14. $_POST[business_name],
  15.  
  16. $_POST[description],
  17.  
  18. $_POST[colours],
  19.  
  20. $_POST[number_of_variants],
  21.  
  22. $_POST[instructions]";
  23.  
  24.  
  25.  
  26. mail($sendTo, $subject, $message);
  27.  
  28. ?>
  29.  
  30.  


ok, so now when i get the email, i just have the variables listed.
how do i add a sort of text to the front of each variable sent.
like
Name : "$_POST[name],
so i know what each line is
this was only a test, and the form will be a lot longer lol

thanks all
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

PHP Code: [ Select ]
 
<?php
 
$sendTo = "nucleo87@badman.com";
 
$subject = "Nucleo's Domain - Quota reply";
 
 
 
$message = "name: $_POST[name],
 
email: $_POST[email],
 
business name: $_POST[business_name],
 
description: $_POST[description],
 
colours: $_POST[colours],
 
number of variants: $_POST[number_of_variants],
 
instructions: $_POST[instructions]";
 
 
 
mail($sendTo, $subject, $message);
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. $sendTo = "nucleo87@badman.com";
  5.  
  6. $subject = "Nucleo's Domain - Quota reply";
  7.  
  8.  
  9.  
  10. $message = "name: $_POST[name],
  11.  
  12. email: $_POST[email],
  13.  
  14. business name: $_POST[business_name],
  15.  
  16. description: $_POST[description],
  17.  
  18. colours: $_POST[colours],
  19.  
  20. number of variants: $_POST[number_of_variants],
  21.  
  22. instructions: $_POST[instructions]";
  23.  
  24.  
  25.  
  26. mail($sendTo, $subject, $message);
  27.  
  28. ?>
  29.  
  30.  

I think thats right....
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

i will give it a go, thanks
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

whoohoo
thanks mate, that did the trick!
  • diverdan
  • Beginner
  • Beginner
  • diverdan
  • Posts: 46
  • Loc: Alabama, USA

Post 3+ Months Ago

if you want line breaks in the email use
Code: [ Select ]
name: $_POST[name],\n
email: $_POST[email]
  1. name: $_POST[name],\n
  2. email: $_POST[email]


the \n will add a line break in between the name and email
imo that makes reading the email a lot easier :)
  • webmasterbrain
  • Beginner
  • Beginner
  • webmasterbrain
  • Posts: 51

Post 3+ Months Ago

These are the best headers I've worked out so far for preventing your email being accidentally marked as spam by aggressive email filters:

$mailheaders .= "MIME-Version: 1.0\n";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1\n"; \\ or text/plain if your sending a plain text email
$mailheaders .= "X-Priority: 3\n"; \\ saying your email is important is kinda risky (duh)
$mailheaders .= "X-MSMail-Priority: Normal\n"; \\ same as above
$mailheaders .= "X-Mailer: php\n"; \\ put whatever you like here, but don't pretend to be a email client your not
$mailheaders .= "From: Name <email@domain.com>\n"; \\ Keep the email address of the next 3 the same
$mailheaders .= "Reply-to: <email@domain.com>\n";
$mailheaders .= "Return-path: <email@domain.com>\n";

You don't actually have to be sending out spam for email to be marked as it, newsletters, automated registration emails, etc, etc, have a tendency to get marked as spam, despite the fact the are solicited.

Some aggressive spam blockers will even manage to block hand-written emails, just because the used the wrong blacklisted word, or the wrong email client, or the wrong IP/Domain etc.

Post Information

  • Total Posts in this topic: 18 posts
  • Users browsing this forum: No registered users and 80 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.