Email Sending problem to 'certain' domains!!

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
shachinb
Forum Newbie
Posts: 4
Joined: Sun Nov 11, 2007 4:13 am

Email Sending problem to 'certain' domains!!

Post by shachinb »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


We are using Swift mailer to send emails to our customers from our site. The biggest problem we are facing is that emails to certain domains are NOT sent. There is no bounce back received and neither is the mail sent to the SPAM folder of the customer. The email just disappears!!! It is sent from our end but is never delivered to the customer.

Emails to Gmail, yahoo, hotmail are sent and received successfully, but emails to AOL domains fail!

We tried sending emails to AOL domain by logging through our web-client and they are sent successfully. But emails sent through swift mailer are never received     Hence this is a code problem

What can be the issue? There may be thousands of domains out there, and we are losing out on customers who are unable to register on our site  How can i make sure that email is always sent? What changes do we need to make in code?


Pleeeeeeeeeeeez help, this has become a very critical problem on our site    

Both mails with and without attachment are NOT sent to AOL. See code snippet below.

Code: Select all

$smtp =& new Swift_Connection_SMTP("localhost",25);

      $smtp->setTimeout( 100 );

      $swift =& new Swift( $smtp );

       $text_body1  = "Mr/Mrs " . $name . ", \n\n";

    $text_body1 .= "has booked a table through Tastykhana.com, make sure the booking process is completed  \n\n";

      $text_body1 .= "Team TastyKhana.com";

      $text_body2  = "Dear $name  \n\n";

      $text_body2 .= "Thank you for using TastyKhana's table reservation service. Your reservation will be confirmed by one of our executives very soon. \n\n";;

      $text_body2 .= "Please refer to the PDF document attached with this email for your order details. For easy identification it would be helpful if you carry along a print of this reservation. \n\n";

      $text_body2 .= "Please note any changes to be made in the reservation can be done by latest 1 hour prior to the booking time. Incase of unavailibilty the restaurant may cancel the booking. \n\n";

      $text_body2 .= "Please contact us for any further queries. \n\n";

      $text_body2 .= "Thank you. \n";

      $text_body2 .= "www.tastykhana.com \n";

      $text_body2 .= "Restaurant Reviews, Table Reservation, Online Ordering and much more...";

       $message =& new Swift_Message("TastyKhana.com table booking");

      $message->attach( new Swift_Message_Part("{message}"));

 
      //Specify the list of replacements as a 2-d array

      $replacements = array(

          $TKBOOKING_EMAIL => array("{message}" => $text_body1),

          $email => array("{message}" => $text_body2)

      );

 
      //Load the plugin with these replacements

      $swift->attachPlugin(new Swift_Plugin_Decorator($replacements), "decorator");

       $message->attach(new Swift_Message_Attachment(new Swift_File($path), $serviceCode.".pdf", "application/pdf"));

      $sender =& new Swift_Address($TKBOOKING_EMAIL, "Tastykhana Bookings");

      $receiver1 = new Swift_Address($TKBOOKING_EMAIL, "");

       if (!$swift->send($message, $receiver1 , $sender)) {

             $errorMessage =  "There has been an error sending mail <br>" .

                        " Please check whether your internet connection is still active";

      }

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
phpBuddy
Forum Commoner
Posts: 37
Joined: Mon Nov 05, 2007 3:42 am

Post by phpBuddy »

This is just a guess.
But I think mail servers are setup to expect / require some basic headers.
And maybe reject those mails with headers having some data or lack some data.
This can be different.
So I would experiment with adding/changing some header attributes.

Swift has got commands to add to header and to display resulting header:
Swift Mailer 3 » Swift Mailer 3 » Message Composition » Manipulating MIME Headers
http://www.swiftmailer.org/wikidocs/v3/ ... on/headers

You can dump headers to have a look, without actually sending you email:

Code: Select all

<?php

/* If you want to dump the entire set of headers, 
you call their build() method like you do with MIME parts: */
$message =& new Swift_Message_Headers();
echo $message->headers->build();

?>
shachinb
Forum Newbie
Posts: 4
Joined: Sun Nov 11, 2007 4:13 am

Not working :(

Post by shachinb »

Couldnt get it working :(

What are the basic headers that need to be included in a mail that will ensure 'every email domain' will receive the email from the PHP code?

The code which I have given below fails to send mails to domains like AOL...

Please help...

Thanks
Post Reply