title: Swift mailer attachment
body: <p>I have tried email extensions in yii twice.</p>
  
  <pre><code>1.YII-MAIL
  2.PHP MAILER
  </code></pre>
  
  <p>Now i would like to try out swift mailer.I have downloaded the package from here <a href="http://swiftmailer.org/download" rel="nofollow">http://swiftmailer.org/download</a> and added it to the extensions folder in YII.</p>
  
  <p>Here i have a form ,with fields for name,email,phone and an attachment.
  I am saving the file uploaded to a folder called resumes under images folder ,at the same time i am sending a mail with all details along with the uploaded file as an attachment .But on clicking create button i am getting this error</p>
  
  <pre><code> include(Swift_Message.php) [&lt;a href='function.include'&gt;function.include&lt;/a&gt;]: failed to open stream: No such file or directory
  </code></pre>
  
  <p>Here is the controller action i have tried so far </p>
  
  <pre><code>public function actionCreate()
  {
              $this-&gt;layout='static_inner';
  
      $model=new LriCareer;
  
      // Uncomment the following line if AJAX validation is needed
      // $this-&gt;performAjaxValidation($model);
  
              if(isset($_POST['LriCareer']))
      {
                      $rnd = rand(0,9999);
          $model-&gt;attributes=$_POST['LriCareer'];
                      if($uploadedFile=CUploadedFile::getInstance($model,'career_resume'))
                      {
                          $fileName = "{$rnd}-{$uploadedFile}";  // random number + file name
                          $model-&gt;career_resume = $fileName;
                          if($model-&gt;save())
                          {
                              $uploadedFile-&gt;saveAs(dirname(Yii::app()-&gt;basePath) . '/images/resumes/'.$fileName);
                              $message = new YiiMailMessage;
                              $first_name="hello";
                              $message-&gt;setBody($first_name);
                              $message-&gt;subject = 'My Subject';
                              $message-&gt;addTo('fazeela.ma@longriverinfotech.com');
                              $message-&gt;from = Yii::app()-&gt;params['adminEmail'];   
                              $uploadedFile = CUploadedFile::getInstanceByName('fileupload'); // get the CUploadedFile
                              $uploadedFileName = $uploadedFile-&gt;tempName; // will be something like 'myfile.jpg'
                              $swiftAttachment = Swift_Attachment::fromPath($uploadedFileName);
                              $message-&gt;attach($swiftAttachment);
                              }
                                 }
                      else
                      {
                           if($model-&gt;save())
              $this-&gt;redirect(array('view','id'=&gt;$model-&gt;career_id));
                      }}
  
      $this-&gt;render('create',array(
          'model'=&gt;$model,
      ));
  
  
      }
  </code></pre>
  
  <p>I dont see Swift_message.php in the folder.Can any one out there can look into the problem</p>