Jump to content

Send email to gmail


Imation

Recommended Posts

Hello all,

 

Actually i m tired of this Google mail hosted domain. I have one domain. Suppose goldenline-bd.com with email address [email protected]. I transferred to this mail address to Google apps. Now all user email i can check through Google apps.

 

On, goldenline-bd.com website i have a simple contact form. When i send email to [email protected], it normally shows mail sent but never receive any email from that contact page. Actually i m sick and tired of this thing. I dunno what to do... can anyone give me any ideas how to start and finish this google apps hosted domain mail thing!

 

Thank you very much. Waiting for your reply...

Link to comment
https://forums.phpfreaks.com/topic/174173-send-email-to-gmail/
Share on other sites

<?php

class MicroMailer{

var $to        = "";

var $subject    = "";

var $message    = "";

var $fromName  = "";

var $fromEmail  = "";

var $replyEmail = "";

var $header    = "";

var $type      = "text/plain";

var $characterSet = "iso-8859-1";

 

 

function send(){

$this->createHeader();

if (@mail($this->to,$this->subject,$this->message,$this->header)){

return true;

} else {

return false;

}

}

 

/**

* This function creates the email header information from the class variables.

*

* @return String: The complete mail header string

*/

function createHeader(){

$from  = "From: $this->fromName <$this->fromEmail>\r\n";

$replay = "Reply-To: $this->replyEmail\r\n";

$params = "MIME-Version: 1.0\r\n";

$params .= "Content-type: $this->type; charset=$this->characterSet\r\n";

 

$this->header = $from.$replay.$params;

return $this->header;

}

 

 

 

}

?>

 

 

<?php require_once("microMailer.php"); ?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">

<html>

<head>

  <title>Micro Mailer Demo</title>

  <link href="style/style.css" rel="stylesheet" type="text/css" />

</head>

<body>

    <div id="main">

      <div class="caption">Send email</div>

      <div id="icon"> </div>

<?php if (!isset($_POST['submitBtn']))  { ?>

      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

        <table>

          <tr><td>To email:</td><td><input class="text" type="text" name="to" size="40" /></td></tr>

          <tr><td>From name:</td><td><input class="text" type="text" name="fromname" size="40" /></td></tr>

          <tr><td>From email:</td><td><input class="text" type="text" name="fromemail" size="40" /></td></tr>

          <tr><td>Reply email:</td><td><input class="text" type="text" name="replyemail" size="40" /></td></tr>

          <tr><td>Subject:</td><td><input class="text" type="text" name="subject" size="40" /></td></tr>

          <tr><td>Message:</td><td><textarea cols="30" rows="6" name="message"></textarea></td></tr>

          <tr><td colspan="2"><br/><input class="text" type="submit" name="submitBtn" value="Send" /></td></tr>

        </table>

      </form>

<?php } else  {

      $mailer = new MicroMailer();

       

  $mailer->to        = isset($_POST['to']) ? $_POST['to'] : "";

      $mailer->fromName  = isset($_POST['fromname']) ? $_POST['fromname'] : "";

      $mailer->fromEmail  = isset($_POST['fromemail']) ? $_POST['fromemail'] : "";

      $mailer->replyEmail = isset($_POST['replyemail']) ? $_POST['replyemail'] : "";

      $mailer->subject    = isset($_POST['subject']) ? $_POST['subject'] : "";

      $mailer->message    = isset($_POST['message']) ? $_POST['message'] : "";

?>

      <div id="result">

        <table width="100%">

          <tr><td>

            <?php

              if ($mailer->send()) {

            echo "Thanks for your message!";

              } else {

              echo "Sending email was failed!";

              }

            ?>

          </td></tr>

        </table>

    </div>

<?php } ?>

    </div>

</body> 

 

 

I use micromailer script. As i m very new to php so its very difficult for me to understand. Lastly, can someone provide me a script so that i can check if its work. Thanks in advance... 

Link to comment
https://forums.phpfreaks.com/topic/174173-send-email-to-gmail/#findComment-918250
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.