Page 1 of 1

blank page + called undefined function : solution inside

Posted: Thu Nov 08, 2007 10:56 pm
by choubix
hi,

I am posting in a separate post in case another new user of swift mailer experiences the same problem as me and searches the forum for the answer.

I think I tried everything possible to get swiftmailer to work. I also created a gmail account to test the script, I tried all authentication methods but still: nothing. In the end I managed to get an "undefined function called..." error showing up on my screen.

possible solution:

for the blank screen:

at the beginning of the script, copy these 2 lines, that should return the errors on screen

Code: Select all

error_reporting(E_ALL); 
ini_set('display_errors', true);

for the "undefined function called":

I found out that in most of the tutorials the smtp connection was initiated as follows:

Code: Select all

$swift = new Swift(new Swift_Connection_SMTP("smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS));
when the correct syntax is:

Code: Select all

$smtp =& new Swift_Connection_SMTP("smtp.gmail.com", Swift_Connection_SMTP::PORT_SECURE, Swift_Connection_SMTP::ENC_TLS);

that sould solce the blank screen and the "called undefined function"

Posted: Thu Nov 08, 2007 11:14 pm
by Chris Corbyn
There's nothing wrong with the first version of that code; it's perfectly legal :? Unless there's some other weird voodoo PHP 5.0.4 bug.

Posted: Thu Nov 08, 2007 11:56 pm
by choubix
hi chris, it must be something like that ;)

will try the other syntax after i upgrade to 5.2 and let you know.

by the way: is it possible to send html templates using swift? (the way images are handled seems to make it a bit difficult no?)

in the meantime: I'm really happy it works! :)

Posted: Thu Nov 08, 2007 11:59 pm
by choubix
hi chris, it must be something like that ;)

will try the other syntax after i upgrade to 5.2 and let you know.

by the way: is it possible to send html templates using swift? (the way images are handled seems to make it a bit difficult no?)

in the meantime: I'm really happy it works! :)



I foudn another post where someone had the same problem btw.

Posted: Fri Nov 09, 2007 12:50 am
by Chris Corbyn
choubix wrote:hi chris, it must be something like that ;)

will try the other syntax after i upgrade to 5.2 and let you know.

by the way: is it possible to send html templates using swift? (the way images are handled seems to make it a bit difficult no?)

in the meantime: I'm really happy it works! :)



I foudn another post where someone had the same problem btw.
You can send HTML with Swift no problem. With HTML you can link to absolutely src'd images (i.e. http://domain.tld/path/to/image.jpg ), or you can embed images as shown in the docs. If you want to embed images, but using the standard HTML syntax you need to load the FileEmbedder plugin.

Posted: Fri Nov 09, 2007 1:13 am
by choubix
thanks chris. will try that this afternoon.

I am already playing with the decorator: really easy to use and so convenient!
you really managed to make my work easier!

you must have spent quite some time on this script!!
Thanks for sharing it :)

Posted: Fri Nov 09, 2007 6:01 am
by Chris Corbyn
choubix wrote:you must have spent quite some time on this script!!
Thanks for sharing it :)
No problem :) I've spent more time on Swift than I have on anything else I develop entirely on my own time.... I'm about to spend a lot more time on it all over again ;)

Posted: Fri Nov 09, 2007 3:27 pm
by choubix
will make a donation soon :)
(not much though :( hope my website will be purchased by google so I can make a better one! ;) )

really I appreciate that you share this with us all.
thanks.

if you have the opportunity to come to singapore, jsut let me know. I'm sure i can offer you a beer in some decent place here :)

by the way: if you notice a huge amount of download from france : this is because of me
I've advertised your mailer to a french community called "phpfrance" ;)