Okay so i'm a total noob. I'm trying to test a basic email script. When ever I browse to the script I just get a blank page. I'm using the swift PHP5 version, and I have PHP5 installed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mailer</title>
</head>
<?php
require_once "/swift/lib/Swift.php";
require_once "/swift/lib/Swift/Connection/Sendmail.php";
//Try to connect using /usr/sbin/sendmail -bs
$swift =& new Swift(new Swift_Connection_Sendmail());
//Create the message
$message =& new Swift_Message("This is a test of this", "Hey man what up, this is the server sending you a message.");
//Now check if Swift actually sends it
if ($swift->send($message, "foo@bar.tld", "seancorgan@gmail.com")) echo "Sent";
else echo "Failed";
?>
</head>
Last edited by gamak on Mon Feb 16, 2009 4:54 pm, edited 1 time in total.
[ /code] tags when posting code blocks in the forums. Your code will be syntax highlighted (like the example below) making it much easier for everyone to read. You will most likely receive more answers too!
Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces. You can even start right now by editing your existing post!
If you are new to the forums, please be sure to read:
[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]
If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online. You'll find code samples, detailed documentation, comments and more.
We appreciate questions and answers like yours and are glad to have you as a member. Thank you for contributing to phpDN!
Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]
Here is the error i'm getting when I turn on error reporting.
Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/swift/lib/Swift.php) is not within the allowed path(s): (/var/www/vhosts/bpmgpublishingsystem.com/httpdocs:/tmp) in /var/www/vhosts/bpmgpublishingsystem.com/httpdocs/test.php on line 12
Warning: require_once(/swift/lib/Swift.php) [function.require-once]: failed to open stream: Operation not permitted in /var/www/vhosts/bpmgpublishingsystem.com/httpdocs/test.php on line 12
Fatal error: require_once() [function.require]: Failed opening required '/swift/lib/Swift.php' (include_path='.:') in /var/www/vhosts/bpmgpublishingsystem.com/httpdocs/test.php on line 12
I have the test script named test.php in /httpdocs/test.php
Swift mailer is in this folder
/httpdocs/swift/(i copied all the swift files here)