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]
I've uploaded the php4 version because my server has php4.
Tested it used the "Sending a HTML E-Mail" this worked fine.
So the next step was:
Sending attachments and Embedding images in HTML E-mails
When I execute these scripts I get blank screens.
This is the simple script working on my server
(replaced x for the real names)Code: Select all
<?php
require_once "admin/swift/lib/Swift.php";
require_once "admin/swift/lib/Swift/Connection/SMTP.php";
$swift =& new Swift(new Swift_Connection_SMTP("x.nl", 25));
$message =& new Swift_Message("Swift test", "Your message <u>here</u>", "text/html");
if ($swift->send($message, "info@x.nl", "info@x.nl"))
{
echo "Message sent";
}
else
{
echo "Message failed to send";
}
//It's polite to do this when you're finished
$swift->disconnect();
?>
This one I used for the Sending attachments.
(replaced x for the real names)
<?php
require_once "admin/swift/lib/Swift.php";
require_once "admin/swift/lib/Swift/Connection/SMTP.php";
$swift =& new Swift(new Swift_Connection_SMTP("x.nl", 25));
$message =& new Swift_Message("My subject");
$message->attach(new Swift_Message_Part("I have attached a file to this message!"));
//Use the Swift_File class
$message->attach(new Swift_Message_Attachment(
new Swift_File("x.pdf"), "x.pdf", "/pub"));
$swift->send($message, "info@x.nl", "info@x.nl");
//recommended to do this
$swift->disconnect();
?>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]