Mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Mail()

Post by Chalks »

I'm trying to make a simple activation email and... I'm having problems:

Code: Select all

$to = $e;
  $subject = 'Chalksdesign Forum Activation';
  $message = "Welcome to Chalks Design forums, " . $u . ".  To activate your account, please go to the following link:  http://forums.chalksdesign.com/activation.php?u=" . $u . "&code=" . $activationCode . "  Please do not reply to this email.  Thank you!";
  $headers = 'From: forums@chalksdesign.com' . "\r\n" .
    'Reply-To: forums@chalksdesign.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

  mail($to, $subject, $message, $headers);
I'm not receiving any emails, and I can't figure out why. :(


Edit: After reading the php manual more thoroughly, I removed the "\r" from the headers because apparently some unix servers and gmail don't like them. However, It's still not working. I've also tried removing the X-Mailer header, but that doesn't seem to make a difference either. Help, please! :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If you insist on using mail() yourself, you will need to add a lot more headers that help with spam filters and other systems.

It is recommended to use Swift Mailer instead, as there are a LOT of nuances that many of us are unaware of making the emails stop somewhere in the line.
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Post by Chalks »

ugh. I knew you would say that.


The reason I haven't used Swift Mailer is because I've been trying to avoid having to install any libraries... because it scares me.

If I make my server explode (not unlikely), I'm totally blaming you, feyd. :D
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

Chalks wrote:ugh. I knew you would say that.


The reason I haven't used Swift Mailer is because I've been trying to avoid having to install any libraries... because it scares me.

If I make my server explode (not unlikely), I'm totally blaming you, feyd. :D
Its not "Installing" anything. Its just simply downloading the files, and running them as needed.

Doesn't suit your needs? Simply delete the files.
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

Post by Chalks »

Zoxive wrote:Its not "Installing" anything. Its just simply downloading the files, and running them as needed.

Doesn't suit your needs? Simply delete the files.
Yeah. I figured that out about 10 minutes after I posted. :oops:

Now I don't have any excuses. heh.
Post Reply