blank page + called undefined function : solution inside

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
choubix
Forum Commoner
Posts: 42
Joined: Tue Nov 06, 2007 12:21 pm

blank page + called undefined function : solution inside

Post 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"
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
choubix
Forum Commoner
Posts: 42
Joined: Tue Nov 06, 2007 12:21 pm

Post 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! :)
choubix
Forum Commoner
Posts: 42
Joined: Tue Nov 06, 2007 12:21 pm

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
choubix
Forum Commoner
Posts: 42
Joined: Tue Nov 06, 2007 12:21 pm

Post 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 :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 ;)
choubix
Forum Commoner
Posts: 42
Joined: Tue Nov 06, 2007 12:21 pm

Post 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" ;)
Post Reply