Solved

php smtp gmail

Posted on 2012-04-01
5
523 Views
Last Modified: 2012-04-01
I need a working php smtp class that can log in to gmail smtp and send mails by it. I already have mail() working, but i want to send a lot of emails, so i want smtp gmail log in, anyone please help, if anyone have a already ready class to do this, i´ll be much greatiful
0
Comment
Question by:pep477
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 37793226
here's a php snippet from http://stackoverflow.com/questions/712392/send-email-using-gmail-smtp-server-from-php-page:

<?php

       require_once "Mail.php";

        $from = "<from.gmail.com>";
        $to = "<to.yahoo.com>";
        $subject = "Hi!";
        $body = "Hi,\n\nHow are you?";

        $host = "ssl://smtp.gmail.com";
        $port = "465";
        $username = "<myaccount.gmail.com>";
        $password = "password";

        $headers = array ('From' => $from,
          'To' => $to,
          'Subject' => $subject);
        $smtp = Mail::factory('smtp',
          array ('host' => $host,
            'port' => $port,
            'auth' => true,
            'username' => $username,
            'password' => $password));

        $mail = $smtp->send($to, $headers, $body);

        if (PEAR::isError($mail)) {
          echo("<p>" . $mail->getMessage() . "</p>");
         } else {
          echo("<p>Message successfully sent!</p>");
         }

    ?>  <!-- end of php tag-->

Open in new window


also check this cool tutorial:
http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/
0
 

Author Closing Comment

by:pep477
ID: 37793364
thank you
0
 

Author Comment

by:pep477
ID: 37793791
I checked that gmail has a 500 mail/day limit. Can i in any way or any other smtp server get that limit higher? i heard that i can create multiple Gmail accounts and than check to see if reached the limit and go to the other account, but Gmail block just the account or they have a control by ip to?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 37794554
Why did accept my post as a solution if you are not satisfied?
This is exactly what u asked for so why grade C?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 37794558
And u still needs my help so wait with the points till you get what u want and only then decide how many points to award...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Part One of the two-part Q&A series with MalwareTech.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question