title: sending mail from yii
body: <pre><code>public function mailsend($name, $contact_no, $email,$website,$content,$subject,$address ) 
  {
      $message        = new YiiMailMessage;
      $message-&gt;view  = 'viewfilenm';
      $message-&gt;setBody(array(), 'text/html');
      $body           = $message-&gt;message-&gt;getBody();
      /******  preg_replace :Perform a regular expression search and replace ******/
      $body           = preg_replace('/\[FNAME]/',$name,$body); 
      $body           = preg_replace('/\[CONTENT]/',$content,$body);
      $find           = array("[CONTACT_NO]"=&gt;$contact_no,"[FNAME]"=&gt;$name,"[EMAIL]"=&gt;$email,"[ADDRESS]"=&gt;$address);
      /****** strtr :Translate characters or replace substrings ******/
      $newstr         = strtr($content, $find);
      $body           = str_replace($content,$newstr,$body);
      $body           = preg_replace('/\[CONTACT_NO]/',$contact_no,$body);
      $body           = preg_replace('/\[EMAIL]/',$email,$body);
      $body           = preg_replace('/\[SUBJECT]/',$subject,$body);
      $body           = preg_replace('/\[WEBSITE]/',$website,$body);
      $message-&gt;message-&gt;setBody($body, 'text/html');
      $message-&gt;subject = $subject;
      $message-&gt;addTo($email);
      $message-&gt;from   = ('abc@abc.com');
      Yii::app()-&gt;mail-&gt;send($message);
  }
  </code></pre>
  
  <p>in <code>$message-&gt;addTo()</code> if I pass my gmail id then in gmail I got the mail.
  but if i pass my yahoo or other id in <code>$message-&gt;addTo()</code> then I don't get the mail and no error also display.</p>