This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

sending mail and setting email content

Notes and reports about symfony 1.0.x stable

sending mail and setting email content

by terrid » Mon Dec 06, 2010 4:22 pm


I have a script that connects to the db via propel and then needs to send an email to an email address.

The content needs t be from a static function, i.e. the script gets rows from a table and then this needs to be sent in the setBody() to send.

Is there an easy way of doing this as I can't seem to do a foreach loop in the setBody()

Code: Select all

$now = time();
$now_12hours = time() - 86400;

$start =  date("Y-m-d H:i:s", $now);
$end   = date("Y-m-d H:i:s", $now_12hours);

 $comments = CommentPeer::getCommentsByPeriod($start, $end);

  $mail = new sfMail();

  // definition of the required parameters
  $mail->setSender(sfConfig::get('app_email_address'), 'My Company webmaster');
  $mail->setFrom(sfConfig::get('app_email_address'), 'My Company');

echo sfConfig::get('app_email_address');

  $mail->setSubject('Your password request');

  // send the email


Code: Select all
        public static function getCommentsByPeriod($start, $end)
            $c = new Criteria();
            $date1Criterion = $c->getNewCriterion(CommentPeer::CREATED_AT, $start, Criteria::LESS_EQUAL);
            $date1Criterion->addAnd($c->getNewCriterion(CommentPeer::CREATED_AT, $end, Criteria::GREATER_EQUAL));
            return CommentPeer::doSelect($c);

Any ideas?
Posts: 39
Joined: Wed Nov 03, 2010 11:03 am

Re: sending mail and setting email content

by Rose » Fri Feb 11, 2011 8:38 am

I appreciate the updates in here! It could help me how could I possibly send email. I have learned how to work on the email setting content.

My Sports Email
Junior Member
Posts: 1
Joined: Fri Feb 11, 2011 8:32 am