Link to home
Start Free TrialLog in
Avatar of pajkico
pajkicoFlag for Canada

asked on

wordpress email form

One of the wordpress web sites unable to send email.
Avatar of Peter Hart
Peter Hart
Flag of United Kingdom of Great Britain and Northern Ireland image

what system is the site using to send the email?
Avatar of pajkico

ASKER

php form, by the way, other web sites on the same server are able to send...
- Has it ever worked?
-  are all plugins and WP up to date?
-  Sometimes the server requires the sending "from" to be an email on that same domain as the website

- you can enable debug in wordpress by editing the wp-config.php file in the root and finding this line:

define('WP_DEBUG', false);

and setting it to TRUE.  if "might" show up the email problem.
Avatar of pajkico

ASKER

well, there were permission problems listed in the mail log. I don't believe that it has ever worked, but I am puzzled with the fact that other sites on the same server don't have this problem.
you need to check with the host on whether you  have access to sendmail. check php.ini to see how the mail() command is defined.

it is likely that your host requires authentication before allowing email acceptance/transmission.
ie no anonymous mail injection.
Avatar of pajkico

ASKER

there are several other web sites on the same host on which email forms work just fine. Are there individual settings for mail form on each of these? So this is sending email from the mail form from the web site's contact page...
sorry you have just stated:
 "well, there were permission problems listed in the mail log. I don't believe that it has ever worked"

so... check the permissions
check the email address (as mentioned above) from who?
Avatar of pajkico

ASKER

Aug 12 09:51:11 lightning sendmail[26474]: u7CDp8kL026472: to=<destanation email>, ctladdr=<apache@lightning.local> (48/48), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=120468, relay=destination-email-domain.1.0001.arsmtp.com. [204.232.236.140], dsn=5.0.0, stat=Service unavailable
Aug 12 09:51:11 lightning sendmail[26474]: u7CDp8kL026472: u7CDpBkL026474: DSN: Service unavailable
Aug 12 09:51:11 lightning sendmail[26474]: u7CDpBkL026474: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31713, dsn=2.0.0, stat=Sent

Ok, what can you deduce from this log?
destination-email-domain.1.0001.arsmtp.com. [204.232.236.140], dsn=5.0.0, stat=Service unavailable

indicates issue on the remote side.


This, <apache@lightning.local>,  too can be the issue, remote server declines to accept an email from a non-existent domain/sender.
SOLUTION
Avatar of Peter Hart
Peter Hart
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pajkico

ASKER

ok, by the way, I just checked with the other tech, the truth is that non of the sites can send from the email form. The one that was successful was using third party smtp, something like amazon so we can disregard that success.

For the wrong email domain as send as email account, it makes sense. These sites are configured in php script to send to the well know exchange provider (appriver) without authentication (the IP is whitelisted) to the relay.appriver.com

This being said, besides correcting the sending email account, what else is required in your opinion?
Avatar of pajkico

ASKER

since this is a wordpress, should this setting be in every wordpress site in an .php file?
you have to check the php mail() are you the admin on the server?

i.e. run telnet IP 25.
Your main issue is that your sender email address that is submitted to the remote server is invalid, lightning.local is not a valid domain and thus the receiving sender rejects the connection with a permanent error 5xx after the sender is identified.  Reconfiguring sendmail or using the -fsender@domain.com should resolve your issue for everysite that specifies a valid sender email address.
Avatar of pajkico

ASKER

I did try to send email from the server's command line using php script, and it was successful:

Created testmail.php like below;
<?php
    mail ('you@example.com', "Test Postfix", "Test mail from postfix");
?>

and after php -f testmail.php the email was sent sent.
check the maillog to see what the from address shows.

the behavior of running the php code from a shell is/could be different then the same one triggered by a web/apache user.

see if the reference by adding headers compensates for sets sender correctly
http://www.w3schools.com/php/func_mail_mail.asp

another option could be to define  a sendmail_from env variable with the address you wish reflected as the sender that is not the same for every site,

this deals with the Envelope sender (identified as mail from: sender in the smtp session)

look at the maillog info on from represented in the log as the ctladdr= in your log, other mailers might show up as from=
Avatar of pajkico

ASKER

Ok, I have changed the recipient in the contact form to my email, and I did receive the email. The log is below:

Aug 15 07:39:42 lightning sendmail[9343]: u7FBdfZT009343: from=<apache@lightning
.local>, size=428, class=0, nrcpts=1, msgid=<201608151139.u7FBdfBO009342@lightni
ng.local>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Aug 15 07:39:42 lightning sendmail[9342]: u7FBdfBO009342: to=info@procc.ca, ctla
ddr=apache (48/48), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30203, re
lay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u7FBdfZT009343 Message accept
ed for delivery)
Aug 15 07:39:42 lightning sendmail[9345]: STARTTLS=client, relay=mail.politart.c
om., version=TLSv1/SSLv3, verify=FAIL, cipher=AES128-SHA, bits=128/128
Aug 15 07:39:49 lightning sendmail[9345]: u7FBdfZT009343: to=<info@procc.ca>, ct
laddr=<apache@lightning.local> (48/48), delay=00:00:08, xdelay=00:00:07, mailer=
esmtp, pri=120428, relay=mail.politart.com. [206.126.88.180], dsn=2.0.0, stat=Se
nt (<201608151139.u7FBdfBO009342@lightning.local> [InternalId=182258] Queued mai
l for delivery)
[root@lightning log]#
Avatar of pajkico

ASKER

So, why would this change make a difference? Those appriver servers are still designated smtp servers defined in the php.ini script as below:

SMTP=relay.appriver.com
smtp_port=2525
The destination is a server that does not have the same restrictions as the former destination. note the envelope sender (mail from: ) is "from=<apache@lightning.local>'

the .local is an internal domain reference and will not resolve externally.
the example the email went into the local sendmail and was delivered to the servers responsible for the sender. versus going to the server you reference or the server to which the prior email was being sent to or through.
*.arsmtp.com. [204.232.236.140] seems to be a third-party that is designed to filter emails for their subscribes from spam/virus, etc.
Avatar of pajkico

ASKER

Ok, so I'll have to add headers to the php.ini script to fix this. Currently php.ini only contains the following:

SMTP=relay.appriver.com
 smtp_port=2525

Therefore, I would need to add headers to this scripts. On another note, since this is only one of the web sites on this WordPress, I would have to do this in every php.ini scripts in corresponding directories (/var/www/html/website.com/php.ini
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pajkico

ASKER

Ok, but I would still have to put email headers in the corresponding php.ini files since there are a number of different web sites with these contact forms, and the sender email would always be the same?
Placing header files in php.ini (system wide) or is there a site specific php.ini that you import will impact every single site. Adding the entry in the PHP mailing mechanism will let you configure specific email to the site versus a general.