Results 1 to 5 of 5

Thread: Send email with SMTP and gmail a/c

  1. #1
    akkimca's Avatar
    akkimca is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    270

    Thumbs up Send email with SMTP and gmail a/c

    Hi,

    i faced some problem to use sugar email functionality so i create new feature which is send mail as a part of sugar. By this i can send mail local server as well so no need to upload and check the email functionality.

    i putting the code
    PHP Code:

    class customScript extends SugarBean
    {
        function 
    customScript($focusObjectId,$foucsObjectType)
        {
                 
    // body
                       
    .................
                       ..................

                
    // define variable
                 
    $to=..............;
                 
    $subject=.............;
                 
    $body=................;
                 
    $this->send_mail($to,$subject,$body);
             }


    function 
    send_mail($to,$subject,$body){
        
            require_once(
    "include/phpmailer/class.phpmailer.php");
                
            
                        
    $mail = new PHPMailer();  // Instantiate your new class
                        
    $mail->IsSMTP();          // set mailer to use SMTP
                        
    $mail->SMTPAuth true;   // turn on SMTP authentication
                        
    $mail->Host "smtp.gmail.com"// specify main and backup server
                        
    $mail->SMTPSecure"ssl"//  Used instead of TLS when only POP mail is selected
                        
    $mail->Port 465;  // Used instead of 587 when only POP mail is selected
            
                        
    $mail->Username "yourgmailid";  // SMTP username, you could use your google apps address too.
                        
    $mail->Password "yourgmailpwd"// SMTP password
                        
                        
    $mail->From "yourgmailid"//Aparently must be the same as the UserName
                        
    $mail->FromName "Test";
                        
    $mail->Subject $subject;
                        
    $mail->Body $body;
                        
    $mail->IsHTML(true);
            
              
    $mail->AddAddress($to);
            
            if(!
    $mail->Send())
            {
              echo 
    "There was an error sending the message:" $mail->ErrorInfo;
              exit;
            }
        
        }

    this is a simple code which helps you to send a mail using phpmailer in sugarcrm.

    may be my code help you

    feel free to ask

    thanks
    Last edited by akkimca; 2010-02-26 at 04:38 AM.
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

  2. #2
    mahe11 is offline Member
    Join Date
    Jun 2010
    Posts
    11

    Default Re: Send email with SMTP and gmail a/c

    Thanks akkimca,

    i used ur suggestions in my logic hooks but its not working . why ? plz help me.. And also there is no any error..

    Regards
    Mahesh

  3. #3
    mangesh1757 is offline Sugar Community Member
    Join Date
    Jan 2010
    Location
    India
    Posts
    226

    Default Re: Send email with SMTP and gmail a/c

    refer : http://www.sugarcrm.com/forums/showt...ighlight=email

    Hope if this might help.

    Thanks

  4. #4
    akkimca's Avatar
    akkimca is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    270

    Default Re: Send email with SMTP and gmail a/c

    hi..
    thanks for using my code

    pls check ur gmail a/c and see all files are properly added or not.. u need the file which i include in requred_once file so pls check out for that file and still u have same problem than give me ur code and files


    all the best
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

  5. #5
    lilly2285 is offline Member
    Join Date
    Aug 2010
    Posts
    4

    Default Re: Send email with SMTP and gmail a/c

    Hello Everybody,

    This is Lilly Michelle. SMTP stands for simple mail transfer protocal. Now we can send email with SMTP and gmail a/c is easy. Thank you.

    __________________________________________________ ___________________________

    Want to get-on Google's first page and loads of traffic to your website? Hire a SEO Specialist from Ocean Groups seo pecialist

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hi all I got error using gmail smtp seeting...
    By sivaprabu in forum Developer Help
    Replies: 5
    Last Post: 2010-07-22, 09:08 AM
  2. send email to gmail account
    By mms1985 in forum Help
    Replies: 5
    Last Post: 2009-06-04, 09:41 AM
  3. Replies: 2
    Last Post: 2008-11-18, 06:41 PM
  4. Gmail Outbound email (SMTP)
    By nathantruant in forum Help
    Replies: 9
    Last Post: 2008-08-10, 06:18 AM
  5. problem with SMTP and Gmail
    By alejandrops in forum Help
    Replies: 8
    Last Post: 2007-12-12, 12:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •