Solved

wordpress email form

Posted on 2016-08-09
23
67 Views
Last Modified: 2016-08-18
One of the wordpress web sites unable to send email.
0
Comment
Question by:pajkico
  • 11
  • 8
  • 4
23 Comments
 
LVL 28

Expert Comment

by:chilternPC
Comment Utility
what system is the site using to send the email?
0
 

Author Comment

by:pajkico
Comment Utility
php form, by the way, other web sites on the same server are able to send...
0
 
LVL 28

Expert Comment

by:chilternPC
Comment Utility
- 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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 28

Expert Comment

by:chilternPC
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
 
LVL 28

Assisted Solution

by:chilternPC
chilternPC earned 250 total points
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:pajkico
Comment Utility
since this is a wordpress, should this setting be in every wordpress site in an .php file?
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 76

Accepted Solution

by:
arnold earned 250 total points
Comment Utility
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
 

Author Comment

by:pajkico
Comment Utility
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
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
This video teaches users how to migrate an existing Wordpress website to a new domain.
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now