E-mail sent but no body

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
grnyj93
Forum Newbie
Posts: 3
Joined: Fri Oct 19, 2007 6:28 pm

E-mail sent but no body

Post by grnyj93 »

I am sending a single e-mail with the following code, the e-mail is sent but the message body content (plain text or HTML) does not come through. It just sends a blank e-mail. The to, from, and subject are all good, just the body is missing.

Code: Select all

<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);

require_once ("swift/Swift.php");
require_once ("swift/Swift/Connection/Sendmail.php");
 
//Try to connect using /usr/sbin/sendmail -bs
#$swift =& new Swift(new Swift_Connection_Sendmail());
	 
	 
//Try to connect using a custom command
$swift =& new Swift(new Swift_Connection_Sendmail("/usr/sbin/sendmail -t"));
	 
//Create the message
$message =& new Swift_Message("My subject", "My body");
 
if ($swift->send($message, "to@domain.com", "from@domain.net")) {
	echo "Message sent";
} else {
	echo "Message failed to send";
}
 
//It's polite to do this when you're finished
$swift->disconnect();
?>
Any help would be greatly appreciated. I am using the following set up.

PHP = 4.4.7
Swift Mailer = 3.3.2 for php4

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

Post by Chris Corbyn »

I strongly urge you not to use 'sendmail -t'. It simply does not work properly (or at least it's never been tested). Can you use 'sendmail -bs' ?
grnyj93
Forum Newbie
Posts: 3
Joined: Fri Oct 19, 2007 6:28 pm

Post by grnyj93 »

If I put "/usr/sbin/sendmail -bs" then it will sit there until it times out. When I view the phpinfo() the sendmail path is "/usr/sbin/sendmail -t -i". I removed the '-i' because it wasn't working with it. The only way I could get it to work was with just the '-t'. Problem is there is no message :(

Any other things that I could try. The site is hosted with FatCow.com if you have any experience with them and if it helps at all.

Thanks for the assistance.
grnyj93
Forum Newbie
Posts: 3
Joined: Fri Oct 19, 2007 6:28 pm

Post by grnyj93 »

I have got it working by using the NativeMail connection option. I would still be interested in a fix or at least a solution (even if it will not work due the host settings) for using sendmail.

Thank you for the help with this.
Post Reply