Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

wordpress email form

Posted on 2016-08-09
23
Medium Priority
?
129 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 29

Expert Comment

by:chilternPC
ID: 41749043
what system is the site using to send the email?
0
 

Author Comment

by:pajkico
ID: 41749055
php form, by the way, other web sites on the same server are able to send...
0
 
LVL 29

Expert Comment

by:chilternPC
ID: 41749201
- 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:pajkico
ID: 41749305
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 80

Expert Comment

by:arnold
ID: 41749514
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
ID: 41749543
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 29

Expert Comment

by:chilternPC
ID: 41749555
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
ID: 41753870
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 80

Expert Comment

by:arnold
ID: 41753955
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 29

Assisted Solution

by:chilternPC
chilternPC earned 1000 total points
ID: 41754472
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
ID: 41754516
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
 

Author Comment

by:pajkico
ID: 41754574
since this is a wordpress, should this setting be in every wordpress site in an .php file?
0
 
LVL 80

Expert Comment

by:arnold
ID: 41755846
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
ID: 41755924
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 80

Expert Comment

by:arnold
ID: 41756027
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
ID: 41756213
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
ID: 41756218
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 80

Expert Comment

by:arnold
ID: 41756229
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 80

Expert Comment

by:arnold
ID: 41756231
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
ID: 41756258
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 80

Accepted Solution

by:
arnold earned 1000 total points
ID: 41756420
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
ID: 41756464
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 80

Expert Comment

by:arnold
ID: 41761135
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content management…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

877 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