Tuesday, January 28, 2014

How to setup Google's SMTP Server settings



You all  know,There are lot of features in  Gmail and Google Apps email   portable SMTP server. you need a free Gmail account or paid Google Apps account.

if you already have an account.you can simply configure Google's SMTP server settings.

Settings

Google's SMTP server requires authentication, so here's how to set it up:


  •  SMTP server (outgoing mail): smtp.gmail.com
  • SMTP username: please include your full Gmail or Google Apps email address  (e.g. test@gmail.com or test@yourdomain.com)
  • SMTP password: add your Gmail or Google Apps email password
  • SMTP port: 465
  • SMTP TLS/SSL required: yes


Sending Limits

Google limits the amount of mail a user can send, via its portable SMTP server. This limit restricts the number of messages sent per day to 99 emails; and the restriction is automatically removed within 24 hours after the limit was reached.



Monday, January 27, 2014

how to setup sendgride with symfony 2


Hi,

Today i'm going to help you.How to config mail With SendGrid. :)

SendGrid provides two ways to send email: through our SMTP relay or through our web API.

I recommend to use SMTP.The main reason to use SMTP the large number of libraries and documentation available for that protocol.

let's start..

1 Step

you have to set minimal changes in :parameters.yml in app/config folder

*Change your SMTP username and password to your SendGrid credentials
*Set the server host name to smtp.sendgrid.net
*Use ports 25 or 587 for plain/TLS connections and port 465 for SSL connections


parameters:
 
    mailer_transport: smtp
    port: 587
    encryption: ~
    mailer_host: smtp.sendgrid.net
    mailer_user: username in sendgride
    mailer_password: password in sendgride
 

2 Step

You can create a email Controller in own your way.i created a controller like this



<?php

namespace Revo\CrmBundle\Controller;

use FOS\UserBundle\Mailer\Mailer;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;;

class EmailController extends Controller
{

    public function getCurrentUser(){
        $userManager = $this->get('fos_user.user_manager');
        $user=$userManager->findUserByUsername($this->getUser());
        return $user;
    }
 
    public function sendMail($mailData){
     
$to = $mailData['to'];
        $subject = $mailData['subject'];
        $message = $mailData['msg'];
        $from = $mailData['from'];
        $headers = "From:" . $from;

        $message = \Swift_Message::newInstance()
            ->setSubject($subject)
            ->setFrom($from)
            ->setTo($to)
            ->setBody($message);

        return  $this->get('mailer')->send($message);

    }

    public function sendMailToContactsAction($deal_id){

        $mailData['to']="abc@123.com";
        $mailData['subject']="test subject";
        $mailData['msg']="This is a test message";
         $mailData['from']="test@123.com";

        return new Response($this->sendMail($mailData));
    }


}

Done..!!!!


Saturday, January 25, 2014

Composer Installation in ubuntu 8-)


  • Locally
To actually get Composer, we need to do two things. The first one is installing Composer (again, this means downloading it into your project):
This will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.
You can install Composer to a specific directory by using the –install-dir option and providing a target directory (it can be an absolute or relative path):
$ curl -sS https://getcomposer.org/installer | php – –install-dir=bin
  • Globally
You can place this file anywhere you wish. If you put it in your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without php.
You can run these commands to easily access composer from anywhere on your system:
$ mv composer.phar /usr/local/bin/composer

Ubuntu commands

  • File permissions sudo chmod 777 -R FOLDERNAME
  • install sh file sh software_name.sh
  • ls Lists the current directory.
  • cat file Concatenates (adds) the contents of the file to your screen.