I went ahead and added the logging code but for some reason nothing was being output. Though I went ahead and installed the /test folder in my swift installation on the server and ran all the smoke tests. None of them passed, they all failed. Then I took a closer look at the TestConfiguration.php file and noticed that perhaps I needed to allow SMTP authentication (which my server does require). So I added my user/pass for the From: email account within TestConfiguration. Then all my smoke tests PASSED.
So thinking that was my problem, I added the following code to my original code:
Code: Select all
$swift->setUsername("myusername");
$swift->setPassword("mypassword");
Code: Select all
# NOTE: IF PHP5 => Take out the & in =&
$swift =& new Swift(new Swift_Connection_SMTP("mail.mydomain.com"));
//Create a message
$message =& new Swift_Message("MyDomain.Com");
$textBody = 'Thank you for registering';
$htmlBody = '<b>Thank you for registering</b>';
//Add some "parts"
$message->attach(new Swift_Message_Part("$textBody"));
$message->attach(new Swift_Message_Part("$htmlBody", "text/html"));
$emailToSendTo = 'anyone@hotmail.com';
//And send like usual
if ($swift->send($message, $emailToSendTo, "help@mydomain.com"))
$confirmEmailSent = TRUE;
else
$confirmEmailSent = FALSE;
However, after testing it, I get the following error:
Fatal error: Call to undefined function: setusername() in /home/usr/htdocs/folder/file.php on line 488
Any idea what could be causing this? Thanks for any help.
