Not sure what the problem is

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
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Not sure what the problem is

Post by DenKain »

Here is the output I receive from the screen when I go to my site:

Code: Select all

 
 
Warning: main(/swiftmailer/lib/Swift.php): failed to open stream: No such file or directory in /home/content/D/e/n/DenKain/html/surveyBoSSwift.php on line 7
 
Fatal error: main(): Failed opening required '/swiftmailer/lib/Swift.php' (include_path='.:/usr/local/lib/php') in /home/content/D/e/n/DenKain/html/surveyBoSSwift.php on line 7
 
Here is my php script:

NOTE: Both the attributes of /swiftmailer/lib/Swift.php and /swiftmailer/lib/Swift/Connection/SMTP.php have been set to 755.

Code: Select all

 
<html>
<body>
 
<?php
 
//Load in the files we'll need
require_once "/swiftmailer/lib/Swift.php";
require_once "/swiftmailer/lib/Swift/Connection/SMTP.php";
 
//Start Swift
$swift =& new Swift(new Swift_Connection_SMTP("smtp.mythicsoftware.com"));
 
//Create the message
$message =& new Swift_Message("My subject", "My body");
 
//Now check if Swift actually sends it
if ($swift->send($message, "admin@mythicsoftware.com", "test@mythicsoftware.com")) echo "Sent";
else echo "Failed";
 
?>
</body>
</html>
 
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Re: Not sure what the problem is

Post by DenKain »

Anyone have an idea?
zecster
Forum Newbie
Posts: 8
Joined: Tue Jul 15, 2008 3:30 pm

Re: Not sure what the problem is

Post by zecster »

are you 100% sure that file is there because i have only every got that php error when the file was not there.
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Re: Not sure what the problem is

Post by DenKain »

Positive.
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Re: Not sure what the problem is

Post by DenKain »

bump
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Not sure what the problem is

Post by Chris Corbyn »

That path looks wrong to me. /swiftmailer refers to a folder called "swiftmailer" in the root directory of the server, not a folder called "swiftmailer" in the web root. Look at the path to your actual script:

/home/content/D/e/n/DenKain/html/surveyBoSSwift.php

Educated guesswork would have me believe the path to SwiftMailer should therefore be:

/home/content/D/e/n/DenKain/html/swiftmailer/lib/Swift.php

?

You can always tests the validity of a filesystem path by passing it through realpath().

Code: Select all

var_dump(realpath($yourPath));
 
/* If output looks like:
 
boolean FALSE
 
Then the path is WRONG.
 
If the output looks like
 
string (19) "/path/to/something/"
 
The the path is CORRECT
 
*/
Post Reply