0

Note: This is not a duplicate of this question, as mine DOES send mail, but it doesn't arrive on the email hosted on the same server as the website.

I have set up a little form on my Wordpress-page through which people can sign up for a course. This form sends a confirmation to the person that signed up, but should also send an email to me telling me someone signed up for a course.

Let's say they sign up on yyy.com. The email telling me someone signed up for a course, should send an email to xx@yyy.com. However, it never arrives, neither does it get thrown in my spam box.

When I change the email to xx@gmail.com, it works without a problem. I have read about this, and it might have something to do with the server trying to email itself (the mail is hosted on the same server) and by that trying to do it locally (and failing horribly at that).

Here's my code:

$email_to = "xx@gmail.com,xx@yyy.com";
                    $subject_billetten = "En deltager har tilmeldt sig kurset "  . get_the_title();
                    $place = get_post_meta(get_the_ID(), 'place', true);
                    $date_start = get_post_meta(get_the_ID(), 'date_start', true);
                    $fornavn_kursist = $_POST['firstname'];
                    $efternavn = $_POST['lastname'];
                    $message_billetten = 
                    'En deltager har tilmeldt sig kurset ' . get_the_title() . ' den '  . strftime("%a, %e. %b. %Y", $date_start) . ' i '  . $place . "\r\n" .
                    'Navn: ' . $fornavn_kursist . ' ' . $efternavn . "\r\n" .
                    'Email: ' . $email;
                    wp_mail($email_to, $subject_billetten, $message_billetten, $headers = 'From: Kursus <info@yyy.com>');

Now, is there a way to fix this, without having access to the server which handles the wp_mail();-function? I tried changing it to just mail();, but that doesn't solve it.

P.S. I have the same problem if I make a new user in that Wordpress-installation and check the "send this new user his login and password"-function. That confirmation email will never arrive. I tell you this, because it makes me think that the fault can't be found in my code.

Community
  • 1
  • 1
Rvervuurt
  • 8,589
  • 8
  • 39
  • 62
  • how are you handling multiple TO address, have you tried with only xx@yyy.com - the mail id must exist – Govind Jul 29 '14 at 11:42
  • The male ID does exist and yes, I have tried with only xx@yyy.com. I also tried with multiple gmail.com and multiple yyy.com. On my local server it works like a charm, on the live website, it doesn't. That's also why I think it's annoying John Conde marked it as a duplicate. – Rvervuurt Jul 29 '14 at 11:49
  • I can also see in the emails I receive, that the xx@yyy.com is between the recipients, it just never arrives at the yyy.com mailbox. – Rvervuurt Jul 29 '14 at 11:50
  • then server setting blocks all the email which goes to yyy.com, check with server people..and ask them to add yyy.com trusted or ask them to allow mail for all domain.. this might solve your problem – Govind Jul 29 '14 at 12:14
  • But sending from my xx@yyy.com to my colleague's cc@yyy.com works, so that is no problem. Have sent an email to the server admin. Thanks anyway! – Rvervuurt Jul 29 '14 at 12:16

0 Answers0