E-mailaddresses (with underscore) registration problem

By kovali - January 4, 2012

Hi,
My website has a registration form for people to register (WebsiteMembership plugin). People have to fill in Name, E-mail and Username to get access to the website. After registration a confirmation e-mail is sent to their e-mailaddress. Everything is working fine, except when a user has an e-mailaddress with underscores in it, like: name_surname@hotmail.com. Then the confirmation e-mail is sent to "name_surname@hotmail.com"@svr124.ehostpros.com (with the hostservername extension at the end)!! Which ofcourse is not going to work with the "ehostpros.com" extension... So the user will not get the confirmation e-mail. It seems that all e-mailaddresses with underscores are not recognized as such ?? The people from Ehostpros.com tell me this is an issue of the used script...

Did anyone have this problem before?

Best regards,
Koen

Re: [kovali] E-mailaddresses (with underscore) registration problem

By (Deleted User) - January 4, 2012

Hello Koen,

When users submit a form to signup with the Website Membership plugin, the email verification function built in to CMSB does permit underscores in the address.

Since users signing up aren't being told their email address isn't valid, the problem must be occurring when the email is being sent.

To find the problem, check the email being sent (the following is roughly what you're looking for)
// send message
$emailTemplate = "emails/user-new-signup.php";
$emailHeaders = emailTemplate_load(array(
'template' => websiteLogin_pluginDir() . "/$emailTemplate",
'subject' => '', // set in template
'from' => '', // set in template
'to' => $_REQUEST['email'],
'placeholders' => array(
'username' => array_key_exists('username', $_REQUEST) ? $_REQUEST['username'] : $_REQUEST['email'], // if using email as username then show that instead
'password' => $_REQUEST['password'],
'loginUrl' => "http://" . $_SERVER['HTTP_HOST'] . $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'],
),
));
$mailErrors = sendMessage($emailHeaders);
if ($mailErrors) { die("Mail Error: $mailErrors"); }


The email address provided by the user when completing the form is used as the 'to' address and so shouldn't be undergoing any modification.

If you can't find the problem, post/attach your code here (just the form processing part) and we can have a closer look.

Hope this helps,

Tom

Re: [Tom P] E-mailaddresses (with underscore) registration problem

By kovali - January 5, 2012

Hi Tom, see my code below, I only added a CC e-mailaddress to it:

// send message
$emailTemplate = "emails/user-new-signup.php";
$emailHeaders = emailTemplate_load(array(
'template' => websiteLogin_pluginDir() . "/$emailTemplate",
'subject' => '', // set in template
'from' => '', // set in template
'to' => $_REQUEST['email'],
'placeholders' => array(
'username' => array_key_exists('username', $_REQUEST) ? $_REQUEST['username'] : $_REQUEST['email'], // if using email as username then show that instead
'password' => $password,
'loginUrl' => "http://" . $_SERVER['HTTP_HOST'] . $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'],
),
));
@$emailHeaders['headers']['CC'] = "info@mysitename.be";
$mailErrors = sendMessage($emailHeaders);
if ($mailErrors) { die("Mail Error: $mailErrors"); }

Re: [kovali] E-mailaddresses (with underscore) registration problem

By kovali - January 5, 2012

And the form processing code:

<?php if ($showSignupForm): ?>
<form action="" method="post">
<input type="hidden" name="save" value="1" />

<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td>Volledige naam</td>
<td><input type="text" name="fullname" value="<?php echo htmlspecialchars(@$_REQUEST['fullname']); ?>" size="50" /></td>
</tr>
<tr>
<td>E-mail adres</td>
<td><input type="text" name="email" value="<?php echo htmlspecialchars(@$_REQUEST['email']); ?>" size="50" /></td>
</tr>
<tr>
<td>Gebruikersnaam</td>
<td><input type="text" name="username" value="<?php echo htmlspecialchars(@$_REQUEST['username']); ?>" size="50" /></td>
</tr>
<tr>
<td>Abonnee Type</td>
<td><select name="abonneetype" size="1">
<option value="">Selecteer aub</option>
<option value="3 Dagen">3 Dagen</option>
<option value="1 Maand">1 Maand</option>
<option value="3 Maanden">3 Maanden</option>
</select>
</td>
</tr>

<tr>
<td colspan="2">
<br />
<strong>Abonnee Prijzen</strong> <br />
15 Euro voor 3 dagen website toegang<br />
30 Euro voor 1 maand website toegang<br />
45 Euro voor 3 maanden website toegang<br />
<br/>
<input class="button" type="submit" name="submit" value="Bevestigen &gt;&gt;" />
</td>
</tr>
</table>

</form>
<?php endif ?>

Re: [Jason] E-mailaddresses (with underscore) registration problem

By kovali - January 5, 2012

Hi Jason,

I don't get any errors when I register on the website with an e-mailaddress with underscores, the e-mailaddress is also saved and displayed correctly within the new user account in CMSB Admin. However, the confirmation mail doesn't arrive (because of the changes made to the mailaddress with the added extension...). With other mailaddresses the confirmation mail always arrives without any problem.

I've also tried your script with an e-mailaddress with underscores, on the same webserver, with succes. I got the message "Message sent succesfully!" and the mail arrived in my mailbox too.

Very strange, no ?

Koen

Re: [kovali] E-mailaddresses (with underscore) registration problem

By Jason - January 8, 2012

Hi Koen,

Do you have access to an email address that you know doesn't receive the password confirmation from the signup form? If you use that email in the email test script, does the email arrive?

Let me know.
Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] E-mailaddresses (with underscore) registration problem

By kovali - January 9, 2012

Yes Jason, I used the same mailaddress that didnĀ“t receive the confirmation from the signup, with your script however the mail arrived.

koen

Re: [kovali] E-mailaddresses (with underscore) registration problem

By (Deleted User) - January 9, 2012

Hi Koen,

I think the nest step would be to look at things more closely - if you could submit a 2nd level support request (http://www.interactivetools.com/support/) we can take a look at everything, including the sendMail function, to see if we can find the error.

Thanks,

Tom