Ticket #805 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Parrot: PHP mail function not sending email

Reported by: annesley Owned by: chris
Priority: major Milestone: IIRS
Component: Parrot server Keywords:
Cc: ed Estimated Number of Hours: 0.0
Add Hours to Ticket: 0 Billable?: yes
Total Hours: 0.5


hi, am using the wordpress / PHP mail function to send registration emails in IIRS.

The system works fine on my BlueHost? server, and also on my laptop but the email does not send on Parrot.

any ideas why?

Here is the headers and code:
From: "Parrot" <annesley@…>
Content-Type: text/html; charset=UTF-8

wp_mail( $email_address, $subject, $body, $all_headers );

Change History

comment:1 Changed 2 years ago by chris

Other sites are sending emails fine, you should be able to test that your site can send email by asking for a password reset?

comment:2 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.25
  • Total Hours changed from 0.0 to 0.25

I can't see any issues in the maillog, the error log for your site and I can't find the code you posted above via a recursive grep.

I created the following file at http://annesley.parrot.transitionnetwork.org/chris.php

//define the receiver of the email
$to = 'chris@webarchitects.co.uk';
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello World!\n\nThis is my first mail.";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: annesley@annesley.parrot.transitionnetwork.org\r\nReply-To: chris@webarchitects.co.uk";
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed";

Visited it and it sent me a email and there were no issues in the maillog.

Can you check you code?

comment:3 Changed 2 years ago by chris

I also notice your site has the Disable Emails plugin installed -- could this be the cause?

Stop a WordPress website from sending any emails using the standard wp_mail() function. No emails will be sent, not even for password resets or administrator notifications.

comment:4 Changed 2 years ago by chris

  • Add Hours to Ticket changed from 0.0 to 0.25
  • Total Hours changed from 0.25 to 0.5

I have just checked (via http://brakertech.com/disable-enable-wordpress-plugin-command-line/) and found that the ​Disable Emails plugin is enabled -- I expect this might be the cause?

comment:5 Changed 2 years ago by annesley

thanks chris! that solved it. impressively stupid of me :)

sorry to have bothered you there!

comment:6 Changed 2 years ago by annesley

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.