To give an actual example, let's say the domain name is tomato.com. I have a process on the webserver at http://www.tomato.com which sends an email to info@tomato.com. That mailbox lives on an Exchange Server in a completely different location to the webserver.
I send it From webmaster@tomato.com. This address does not actually exist within the webserver - but then none do. In addition to sending it To info@tomato.com, I also bcc the email to another address (bcccopy@anotheraddress.com) on completely different domain.
What happens is that the email never reaches info@tomato.com but it does get to bcccopy@anotheraddress.com, showing that the Swift code actually sends the email out.
I have tried all sorts of things like creating the sending address on the webserver, and checked with the receiving
Exchange Server IT people to see if any filtering might be taking the email but no luck.
My code looks like this and it is Swift 3.3.3 :
Code: Select all
$swift =& new Swift(new Swift_Connection_SMTP("localhost"));
//Create the message
$message =& new Swift_Message("Message from tomato website");
$message->attach(new Swift_Message_Part($textmessage));
$message->attach(new Swift_Message_Part($htmlmessage, "text/html"));
$recipients =& new Swift_RecipientList();
$recipients->addTo("info@tomato.com");
$recipients->addBcc("bcccopy@anotheraddress.com");
//Now check if Swift actually sends it
if ($swift->send($message, $recipients, new Swift_Address("webmaster@tomato.com", "Webmaster"))) echo "OK "; else echo "Failed";