Forum Moderators: coopster

Message Too Old, No Replies

Newsletter signup

         

RammsteinNicCage

8:10 pm on May 17, 2004 (gmt 0)

10+ Year Member



I'm a complete php newbie. What I'm trying to do is put a form on my site with an email text box and a subscribe button (and an unsubscribe button would be nice too, but not necessary).

I don't think there's any problem with my form:

<form action="/newsletter_signup.html" method="post">
<input type="text" name="email" value="Your Email Address" onfocus="value=''" />
<input type="submit" value="Subscribe!" />
</form>

In my newsletter_signup.html page (I'm parsing php as html), I have:

<?php
print "Thank you for signing up for the newsletter!<br /><br />";
print "An email has been sent to $_POST[email] to confirm your subscription.<br /><br />";
print "After you confirm your subscription, newsletters will be sent to $_POST[email].<br /><br />";
print "If you would like to unsubscribe, please send a blank email to newsletter-unsubscribe@example.com from the email address that you used to sign up.";
$recipient = "newsletter-subscribe@example.com";
$subject = " ";
$msg = " ";
$mailheaders = "From: $_POST[email]";
mail($recipient, $subject, $msg, $mailheaders);
?>

After submitting my email address, I get redirected to the newsletter_signup.html page, but I don't get an email. When I tested this last night, I could have sworn I got the email, but it's not working today. What (numerous things) am I doing wrong?

Jennifer

Timotheos

8:38 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is your server set up to parse html files for php?

RammsteinNicCage

8:42 pm on May 17, 2004 (gmt 0)

10+ Year Member



Yup - via .htaccess.

Jennifer

jatar_k

8:55 pm on May 17, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



do you have some type of spam filtering on your email provider. With a blank subject and blank message it may not like you. ;)

Timotheos

8:58 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup - via .htaccess.

That much would be obvious, eh? :-)

So you say you can see the post variable all right but there's no error messages and you don't receive any email?

One other meager suggestion I have is to put a new line on the header.

$mailheaders = "From: $_POST['email']\r\n";

or

$mailheaders = "From: $_POST['email']\n";

RammsteinNicCage

9:06 pm on May 17, 2004 (gmt 0)

10+ Year Member



Yup, after submitting, I get this:

Thank you for signing up for the newsletter!

An email has been sent to email@address.com to confirm your subscription.

After you confirm your subscription, newsletters will be sent to email@address.com.

If you would like to unsubscribe, please send a blank email to newsletter-unsubscribe@example.com from the email address that you used to sign up.

no email though. When I send an email directly to newsletter-subscribe@example.com through my inbox, it works great. As for spam filters, I have my domain safe-listed.

Jennifer

Timotheos

10:27 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So did you try the carrage return on the header line?

Guess it's back to the basics. Replace the mail function with something like...
mail("newsletter-subscribe@example.com", "Test", "Test");

If that works then it's something you're feeding the mail function else it's something up with the mail server or php configuration.

RammsteinNicCage

10:38 pm on May 17, 2004 (gmt 0)

10+ Year Member



Sorry, forgot to say that I did try the carriage returns, neither worked.

When I try doing "mail("newsletter-subscribe@example.com", "Test", "Test");" how does the email address of the submitter get sent?

Jennifer

jatar_k

10:58 pm on May 17, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Timotheos wants you to try that so you can test the mail function specifically to see if everything is conf'ed properly. That will help to isolate the problem.

RammsteinNicCage

11:04 pm on May 17, 2004 (gmt 0)

10+ Year Member



Gotcha. That seems to be the problem, I'm still not getting the email.

Jennifer

Timotheos

11:04 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I could've just asked if you've ever successfully used the mail function on this server.

RammsteinNicCage

11:05 pm on May 17, 2004 (gmt 0)

10+ Year Member



New host, first time I've tried it.

Jennifer

RammsteinNicCage

3:25 am on May 18, 2004 (gmt 0)

10+ Year Member



Ok, I just finally got the last test email I sent about five hours later using "mail("newsletter-subscribe@example.com", "Test", "Test");" but still haven't gotten any of the actual subscription confirmation emails yet. Why would this take so long? And how come if I email directly to newsletter-subscribe@example.com, it's almost instantaneous?

Jennifer

RammsteinNicCage

1:10 pm on May 18, 2004 (gmt 0)

10+ Year Member



Well, I finally did get all of the subscribe requests after 1am. So, there's nothing wrong with the mail(), but is there anyway I can speed this up or is this a server setting?

Jennifer

bumpaw

1:11 pm on May 18, 2004 (gmt 0)

10+ Year Member



New host, first time I've tried it.

Have you tried using your hosting tech support? If they are good sometimes their perspective will allow them to spot something you can't see. Mine will even go in and do small config adjustments in the scripts.

jatar_k

4:42 pm on May 18, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



since everything worked but just took forever I think contacting your host is the best idea. The code in this case is irrelevant, I would think something is going on with a mail server somewhere.

RammsteinNicCage

5:18 pm on May 18, 2004 (gmt 0)

10+ Year Member



Ok, thanks for the help everyone!

Jennifer

RammsteinNicCage

6:05 pm on May 19, 2004 (gmt 0)

10+ Year Member



Ok, one more question now. :) I contacted my host about this and said that I was hoping for something a little more instantaneous than a 7-12 hour for the confirmation email and this is what they said:

<essentially said they couldn't help - jatar_k>

My question is, is it really the mailing list software that would cause a delay? I wouldn't think so, especially since I do get an immediate confirmation email when I send a request from my inbox. So, that leaves me with either there really is something wrong with my script or it has to be something with their mail configuration, right?

Jennifer

[edited by: jatar_k at 7:52 pm (utc) on May 19, 2004]
[edit reason] no email excerpts - TOS #9 [/edit]

bumpaw

6:40 pm on May 19, 2004 (gmt 0)

10+ Year Member



I'm confused as normal, but are you using a PHP newsletter that you installed or are you using the one that the host described (ezemlm)?

RammsteinNicCage

6:58 pm on May 19, 2004 (gmt 0)

10+ Year Member



I'm using the installed newsletter, ezemlm, but a php script to allow people to sign up for it. Is that my problem?

Jennifer

jatar_k

7:51 pm on May 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



my guess would be that it is the mail configuration in particular since the sign up script is not specifically linked with ezmlm