Jump to content

does anyone know a php script to send mail using gmails/googles free smtp server


Recommended Posts

ok well i contacted my host about it not working or sending 30 -60 minutes after the code is run and they stated its because of some filtering it goes through and gave me a link to

http://phpmailer.worxware.com/index.php?pg=projects

it says its some license thing i dont understand licenses i try to stay away from them. does nayone know if its free for liek comercial sites or whatever to use? cause i am going to have a webstore on my site etc in the future and i cant use anything that doesnt allow comercial use for free.

and also... on the forum i read something about the users using google apps for mail but ive done some googling and stuff i cant figure out how to send mail with that it makes no sense does anyone know what that is??

http://www.google.com/apps/intl/en/group/index.html

 

PHPMailer is licensed under the LGPL which means it is basically free to use.

 

What is it exactly you want to know about using google apps for mail? if your users want to setup google apps for mail, you will still need a third party class such as PHPMailer (or my before mentioned zend_Mail) to connect to google and send from your sites.

Hai

try this to send emails using the gmail as an smtp..

 <?php
    require_once "Mail.php";

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

    $host = "ssl://mail.example.com";
    $port = "465";
    $username = "smtp_username";
    $password = "smtp_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>");
     }
    ?>

 

but you require a correct user id and password to use it.

u can use the gmail user id and pass ... :P

what pears mail class?

sorry how do i figure out if thats installed?

is that script similar to this one i found:

http://blog.dagoosh.com/post/2009/03/17/google-apps-gmail-send-email-asp.aspx

 

well the admin on the support forum says that free hosting account users like me uuse google apps to send but i cant figure out how.. so i guess the host lets the free accounts use it but how?

 

oh and basically free? whats that actually mean? if i have a webstore that sends mails all the time for comerical uses can i still use it or what? i dont get licenses

This isn't going anywhere fast.

 

At minimum you need to install one of these third party classes to be able to use gmail's smtp server easily. You can use either (and this is by no means a definitive list) PHPMailer, PEAR's Mail or Zend_Mail.

 

I suggest you decide which one you want to use, read the installation instructions and get one installed. If you get stuck, let use know exactly where you are stuck.

 

From there, you will need to (again) read the manual for the specific class to find out how to use it.

hai thorpe.

he is using an free hosting service so i dont think he could able to do that..

 

Why? These scripts are all written in php. You just place then on your server, put them within your include path then include and use them.

$transportConfig = array('smtp_host' => 'smtp.gmail.com', 'smtp_port' => '456', 'smtp_ssl' => '1', 'smtp_user' => 'mail@gmail.com', 'smtp_password' => 'mail password');
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $transportConfig);

$mail = new Zend_Mail();
$mail->setFrom('user@mail.com');
$mail->setReplyTo('user@mail.com');
$mail->setReturnPath('user@mail.com');// in case of failed delivery
$mail->setSubject('Mail Subject');

$mail->addTo('mail@gmail.com');
$mail->setBodyText('Mail Message');// or $mail->setBodyHtml('Html Mail Message');
$mail->send($transport);

ok this zend mail thing that someone left a code for...

is this free for use on commercial websites?

because my site is going to have a webstore etc..

and i wanted a code to use google apps to send mail from my site. because i cant use my hosts email sender it sucks. like on a registration it sends an email that the user has to click on the link in the email to verify its an ok email

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.