Jump to content

Comments -- core module -- error


mtn
 Share

Recommended Posts

The "Comments" core module has been activated locally with its four associated parts, including an Akismet API key, and has been rendered as per instruction via http://processwire.com/api/fieldtypes/comments/.  Testing the comment form continues to render errors after this manner in the 3.0.96 version.

Error: Exception: Invalid email address (processwire@localhost:8888) (in ... /wire/core/WireMail.php line 130)

 

After an exhaustive attempt on my part to overcome this error (with limited knowledge), I considered that maybe a corrupt file might be the cause.  However, after updating from 3.0.62 to 3.0.96, the same error persists.  Below is the particular section/line of code mentioned.

/**
 * Sanitize an email address or throw WireException if invalid
 *
 * @param string $email
 * @return string
 * @throws WireException
 *
 */
protected function sanitizeEmail($email) {
    $email = strtolower(trim($email));
    $clean = $this->wire('sanitizer')->email($email);
    if($email != $clean) {
        $clean = $this->wire('sanitizer')->entities($email);
        throw new WireException("Invalid email address ($clean)");  //<--- this is the line
    }
    return $clean;
}

 

Inasmuch as this is the final element that needs to be addressed for this particular site, your assistance in helping me understand the issue and the remedy regarding this matter would be greatly appreciated.  Good day!

 

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
On 3/27/2018 at 6:29 AM, cstevensjr said:

 

The Comments Fieldtype is explained at the following link:

http://processwire.com/api/fieldtypes/comments/

pw-comments1.thumb.png.c1ce65e92b1cd56577f9c9d24b2a5ec7.png

I believe you need to go to your Comment field and enter an email address.  The last 2 images show what a Comment field looks like

pw-comments2.thumb.png.b1c957c7e11c5db21a314afe2c04b90b.png

pw-comments3.thumb.png.c0d705573900513b4ffff43a59ddfd97.png

 

 

I added the email to this field, but still the error persists ....

Link to comment
Share on other sites

Good evening

I have a website where the content is loaded via Ajax and there is also the comments moduel loaded. Now when submitting a comment I would like to do this via ajax aswell without reloading the whole page.
Is this possible with the comments core module?

Would be great if you could give me some hints how to get started.

Best wishes, L

Link to comment
Share on other sites

  • 2 weeks later...

Interestingly enough, the latest dev version of /wire/core/WireMail.php has changed in a way that I believe addresses your issue.

 

/**
	 * Sanitize an email address or throw WireException if invalid or in blacklist
	 * 
	 * @param string $email
	 * @return string
	 * @throws WireException
	 * 
	 */
	protected function sanitizeEmail($email) {
		if(!strlen($email)) return '';
		$email = strtolower(trim($email)); 
		if(strpos($email, ':') && preg_match('/^(.+):\d+$/', $email, $matches)) {
			// sending email in particular might sometimes be auto-generated from hostname
			// so remove trailing port, i.e. ':8888', if present since it will not validate
			$email = $matches[1]; 
		}
		$clean = $this->wire('sanitizer')->email($email); 
		if($email !== $clean) {
			throw new WireException("Invalid email address: " . $this->wire('sanitizer')->entities($email));
		}
		/** @var WireMailTools $mail */
		$mail = $this->wire('mail');
		if($mail && $mail->isBlacklistEmail($email)) {
			throw new WireException("Email address not allowed: " . $this->wire('sanitizer')->entities($email));
		}
		return $clean;
	}

Looking at the comments, it seems like the email address you're using (processwire@localhost:8888?) is invalid due to the :8888. Try removing the port and see what happens.

 

Edit: oh maybe it's because this thread is from 2018. WTF

Edited by awesomolocity
Link to comment
Share on other sites

  • 1 year later...
On 3/27/2018 at 1:11 AM, mtn said:

The "Comments" core module has been activated locally with its four associated parts, including an Akismet API key, and has been rendered as per instruction via http://processwire.com/api/fieldtypes/comments/.  Testing the comment form continues to render errors after this manner in the 3.0.96 version.



Error: Exception: Invalid email address (processwire@localhost:8888) (in ... /wire/core/WireMail.php line 130)

 

After an exhaustive attempt on my part to overcome this error (with limited knowledge), I considered that maybe a corrupt file might be the cause.  However, after updating from 3.0.62 to 3.0.96, the same error persists.  Below is the particular section/line of code mentioned.



/**
 * Sanitize an email address or throw WireException if invalid
 *
 * @param string $email
 * @return string
 * @throws WireException
 *
 */
protected function sanitizeEmail($email) {
    $email = strtolower(trim($email));
    $clean = $this->wire('sanitizer')->email($email);
    if($email != $clean) {
        $clean = $this->wire('sanitizer')->entities($email);
        throw new WireException("Invalid email address ($clean)");  //<--- this is the line
    }
    return $clean;
}

 

Inasmuch as this is the final element that needs to be addressed for this particular site, your assistance in helping me understand the issue and the remedy regarding this matter would be greatly appreciated.  Good day!

 

The error is triggered when we leave empty the configuration field "Notifications From Email". 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...