Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
The contact 7 form in one of wordpress website is configured to send email to an account created in outlook.com
The form on submission shows success message but the message is never received in my outlook account.
Setting the recipient email to any gmail account works fine as email is received successfully.
Please suggest any possible solution for this.
I had the exact same problem, and emails never even reached the junk folder, they just never arrived. Here is what I did:
In outlook.com:
In your account -> click the settings gear -> More mail settings -> Safe and blocked senders -> safe senders.
Add your domain: example.com
For hostname it wont be white listed automatically so add it as well: yourhost.example.com
PHP:
Make sure your $senderEmail (that is attached to the $headers) is within the safe sender you have added.
$headers = "From: " . $senderName . " <" . $senderEmail . ">";
$success = mail( $recipient, EMAIL_SUBJECT, $message, $headers );
This made it go straight to inbox.
Hope this helps.
EDIT:
It may also be far easier and productive to use a 3rd party service such as SendGrid or MailGun since directly meddling with email and servers configurations could be a major time sink.
Related
Tried many times but no luck... I don't where the problem. Required help in solving the above code.
//SEND MAIL
$mymail=file_get_contents("mailaddress.txt");
$frommail=file_get_contents('CCmail.txt');
$to = $mymail;
$subject = "User details";
$txt = "<b>USER DETAILS</b>\r\n\r\nName: $fname\r\nEmail: $email\r\nContact no: $mobile\r\nProvince: $city $state\r\n Gender: $gender\r\nComment: $comment\r\n\r\n<b>QUESTION & ANSWERS</b>\r\n\r\nGender: $selectedgender\r\nSleeping Hours: $sleep\r\nWorking Hours: $work\r\nWeight & Height: $weightheight\r\nIllness: $illness\r\nAllergies: $allergies\r\nSweating: $sweating\r\nAge: $age\r\nSpecial Care: $care\r\nSleeping Position: $sleepingposition\r\nLevel Of Comfort: $comfort\r\nPreference: $preference\r\n";
$headers = "From: $frommail" . "\r\n" .
"CC: $frommail";
wp_mail($to,$subject,$txt,$headers);
echo"successfull";
}
}
else{
echo"Not Allowed";
}
?>
For WordPress (or indeed for any software) to send email messages it needs to have access to a Simple Mail Transfer Protocol (SMTP) server somewhere on the Internet.
The best way to do this is to
install a WordPress plugin like WP Mail SMTP. It takes over from php's rudimentary built-in SMTP handler. It also provides a plugin settings screen where you can configure your email settings.
get yourself an account on one of the SMTP services mentioned in the plugin's documentation. I like sendgrid.com for this purpose, because it has a free tier allowing up to 100 messages a day forever.
You could use the SMTP server belonging to your own email provider. But the big providers like gmail and yahoo really don't like automated email systems sending email through them, and they may refuse connections from your WordPress instance. They especially don't like incorrectly formatted email messages: the kind you might send while debugging your application. They're trying to resist attacks from spammers and cybercreeps.
Write and test your code sending only to email accounts under your control (avoiding developer spam to unsuspecting people).
A word to the wise: many countries prohibit "protected health information" -- data about medical patients -- in email messages. It's impossible to guarantee the confidentiality of email due to the way it works.
In the USA it's even illegal for a hospital or doctor to send ANY email to a patient without that patient's consent: the From: and To: fields of the email identify the recipient as a patient of the sender. Respect your patients' confidentiality!
For quite some time we have been getting the following error from yahoo:
mail.log:6452:Apr 22 19:21:06 aegir postfix/smtp[8997]: 87BCF4C93F: host mta7.am0.yahoodns.net[67.195.228.110] said: 421 4.7.0 [IPTS04] Messages from 188.93.125.68 temporarily deferred due to user complaints - 4.16.55.1; see https://help.yahoo.com/kb/postmaster/SLN3434.html (in reply to end of DATA command)
If someone did get the similar, how did you solve this issue?
I've been trying to contact Yahoo but everytime I get automated response and ticket closure as I send it.
What other thing I can offer is DMARC report if its relevant:
https://mxtoolbox.com/DmarcReportAnalyzer.aspx?id=F-9a3a8364-6cba-41f9-b93f-cfc32155a3f6
Test for headers and every check seems to be working alright:
https://www.mail-tester.com/test-m5ytebosm
Google email is showing everything is pass:
gmail email
gmail header
For now I've tried changing OpenDKIM to relaxed/relaxed from relaxed/simple.
Removed p=quarantine and added p=none
Sorted out SPF record for official signing domain just in case, added another IP address where resourcecenter is found.
Will provide additional info if needed.
All the mails sent from a Contact Form 7 form are being marked by gmail as spam.
A hint: I looked at the option "Show Original" and I found stuff like this:
Return-Path: <www-data#localhost>
....
Received-SPF: none (google.com: www-data#localhost does not designate permitted sender hosts) client-ip=178.216.103.114;
....
Authentication-Results: mx.google.com;
spf=neutral (google.com: www-data#localhost does not designate permitted sender hosts) smtp.mail=www-data#localhost;
dmarc=fail (p=NONE dis=NONE) header.from=gmail.com
See all thos www-data#localhost ? My guess is that they have something to do with the problem (but I could be wrong).
What could I do to solve this problem on the server side?
This is a common issue with Contact Form 7 and some php mail or server settings on some hosts.
Try hardcoding the sender name in the ‘From:’ field in the ‘Mail’ section like Webmail <a-valid-address#mydomain.com> This means you won't see the sender name or email as names and return emails in your incoming mail box, but that doesn't matter much, as the sender's email will be in the body of the message.
If that doesn't work, try https://wordpress.org/plugins/wp-mail-smtp/ to use SMTP instead of php mail.
And see http://contactform7.com/faq/ and http://buzztone.com.au/contact-form-7-email-issues/
This can be solved via using "WP Mail SMTP" plugin which is for enabling SMTP auth in wordpress. Just install the plugin via wordpress admin or download and extract the plugin zip file to wordpres plugins folder. Correct permissions.
Activate "WP-Mail-SMTP" plugin in wordpress admin >> Plugins. Then go to Wordpress Admin >> Settings >> Email
Enter your email settings as mentioned in the screen shot. Make sure you have turned ON "Use SMTP authentication". If you are using remote MX, specify the remote MX instead of "localhost" in SMTP Host.
This month i had the same problem, after suffering for two weeks I found the problem.
The WordPress default CONFIG -> DISCUSSION is applying the disallowed words list to the CF7 forms.
Try adding this code snippet to your child theme functions.php file:
/**
* CONTACT FORM 7
* Disable WP Disallowed List for SPAM validation
*/
add_filter( 'wpcf7_submission_has_disallowed_words', '__return_false', 10, 2 );
It worked for me.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a postfix mail server on ubuntu on my virtualbox,now the domain of the mail server is abc.com...hence it receives mail from any "from address" but the "to address" needs to be proper i.e a valid user in the mailserver.
Now,in my project i am sending fake mails to user whose mail id consists of other domains too...like cde.com
My final objective is to show the mails in the mail server.
When i tried that ,it goes directly in to the mailserveer logs i.e /var/log/mail.log i.e as an error
is there any way i can store these mails in the mailserver??
You want not only a Catch-All configuration like accepting any mail to *#abc.com but also to have a Catch-Anything configuration to accept any mail to *#* ?
This is possible if you have the PCRE support compiled into Postfix. Then you need virtual users in your configuration (see the Posfix documentation) and tweak it as follows:
Make sure that your Postfix is already configured to accept mail for at least one user and one domain. And that this is tested.
1) In main.conf set
virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual_forwardings, pcre:/etc/postfix/virtual_forwardings.pcre
virtual_mailbox_domains = hash:/etc/postfix/virtual_domains, pcre:/etc/postfix/virtual_domains.pcre
The hash: parts are the known from the docs. And the pcre: parts are new.
The hash: parts can also be omitted.
2) Create the file virtual_domains.pcre with the following content:
/^.*/ OK
This accepts any domain as valid recipient domain.
3) Create the file virtual_forwardings.pcre with the following content:
/#.*/ someuser#example.com
This forwards any local part of any domain to the Postfix user someuser#example.com. Make sure that this is a valid virtual or local user.
In this configuration it seems that Postfix is an Open Relay, but it does not relay for other domains. It accepts mails for any domain and locally delivers the mail to one mailbox.
Sometimes you will then notice a log entry telling you something like "don't list abc.com in mydestination and virtual config". This warning can be ignored as this "strange" setup is not usual.
FTR:
An alternative way to do it by sending any mail to "some.local.user" (a shell user)
Required: postfix-pcre package
in main.cf
luser_relay = some.local.user
local_recipient_maps =
virtual_alias_maps = pcre:/etc/postfix/virtual_alias.pcre
mydestination = $myhostname, pcre:/etc/postfix/mydestination.pcre
File: /etc/postfix/virtual_alias.pcre
(catchall mapped to "some.local.user")
/\/#/ some.local.user
__
File: /etc/postfix/mydestination.pcre (we accept whatever you throw at us)
/.*/ OK
I have a problem on how to send mail on notification while editing or creating any contents in open atrium.
I have followed as mentioned in below link
https://community.openatrium.com/documentation-en/node/28
but was not successful in sending mail to notified user on creating or editing of contents.
And also i wanted to send a mail to user when his credentials is changed or edited.
May can anyone help me in rectifying this issues.
Is your server/PHP enabled to send mails?
Maybe that is not the case and this is why no messages are sent.
In any way you can do a couple of tests to check that out what is wrong. For some, you will need the devel module installed:
Check if your server has the SMTP functionality installed and running (how to check this changes a lot from server to server)
Check if your PHP installation manages to send mail. There are plenty of available scripts to do this on the internet. I C&P one below.
Check if you can send mails with drupal (with the develop module installed, visit http://example.com/devel/php and use the drupal_mail() function.
Change the setting from the devel module and put the mail to "log only": this will show you if Open Atrium is at least trying to send them.
Example PHP script to test mail functionality.
$to = "recipient#example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
}
else {
echo("<p>Message delivery failed...</p>");
}
?>
HTH!
According to the OpenAtrium Installation docs, all you need to do is enable the [standard Drupal cron job]. That worked for me in my OpenAtrium installation. Just to be clear, I did not have to alter php.ini or install the Drupal SMTP module.
Documentation is not realistic. Take a look to this post:
https://community.openatrium.com/issues/node/79
Fixed installing smtp module and letting openatrium mail with PHPMailer.