• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

wordpress email form

One of the wordpress web sites unable to send email.
0
pajkico
Asked:
pajkico
  • 11
  • 8
  • 4
2 Solutions
 
chilternPCCommented:
what system is the site using to send the email?
0
 
pajkicoPresidentAuthor Commented:
php form, by the way, other web sites on the same server are able to send...
0
 
chilternPCCommented:
- 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.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
pajkicoPresidentAuthor Commented:
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.
0
 
arnoldCommented:
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.
0
 
pajkicoPresidentAuthor Commented:
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...
0
 
chilternPCCommented:
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?
0
 
pajkicoPresidentAuthor Commented:
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?
0
 
arnoldCommented:
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.
0
 
chilternPCCommented:
I think what this means is ....
the server just can't send emails without a valid email account.
the server requires the sending "from" to be an email on that same domain as the website
so you need an email account on the same domain as the website and use those credentials in the php emailer form
i.e. your website is  www.yourwebsite.com  and the email (that should also exist)  should be maybe someone@yourwebsite.com

are you using a valid email account?
0
 
pajkicoPresidentAuthor Commented:
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?
0
 
pajkicoPresidentAuthor Commented:
since this is a wordpress, should this setting be in every wordpress site in an .php file?
0
 
arnoldCommented:
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.
0
 
pajkicoPresidentAuthor Commented:
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.
0
 
arnoldCommented:
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=
0
 
pajkicoPresidentAuthor Commented:
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]#
0
 
pajkicoPresidentAuthor Commented:
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
0
 
arnoldCommented:
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.
0
 
arnoldCommented:
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.
0
 
pajkicoPresidentAuthor Commented:
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
0
 
arnoldCommented:
Do you actually want to use an SMTP session versus injecting the message into the local MTA (sendmail, postfix) and allowing it to deliver the message?

you could configure the local MTA sendmail, postfix with smarthost/relayhost that will forward all outgoing emails through a desired relay.

I still suggest that your issue is that you do not set a valid sender email address and that is where the issue is.

Adding headers would not alter the sender identified during the SMTP session.

look at using ini_set(from_sendmail,'sender@yourdomain.com'); before sending out a message

See http://php.net/manual/en/ref.mail.php
this will/should set your outgoing sender to a valid email address replacing the default which is currently on the @lightning.local

and this change within every mechanism that mail, should resolve your issue.
0
 
pajkicoPresidentAuthor Commented:
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?
0
 
arnoldCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 11
  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now