Jump to content

laroi

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by laroi

    help

    Hi friends,

                    Can you guys please help me in creating a website which fetches the profile details of a Linked In user by providing a username...

                    Any help on this topic will be highly appreciated

  1. Hi brothers

                    I am a newbie in php as well as in this forum. I wish some body help me out with the mail sending function in php. using the help with google i set up one page. It is perfectly working if we are sending mails to gmail. it doesn't support any other domains. I don't know what is happening. Can any body help me? I am posting the code I used here  below

     

    Index.php

    <?php

    include('SMTPconfig.php');

    include('SMTPClass.php');

    if($_SERVER["REQUEST_METHOD"] == "POST")

    {

    $to = $_POST['to'];

    $from = $_POST['from'];

    $subject = $_POST['sub'];

    $body = $_POST['message'];

    $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);

    $SMTPChat = $SMTPMail->SendMail();

    }

    ?>

    <form method="post" action="">

    To:<input type="text" name="to" />

    From :<input type='text' name="from" />

    Subject :<input type='text' name="sub" />

    Message :<textarea name="message"></textarea>

    <input type="submit" value=" Send " />

    </form>

     

     

     

    SMTPclass.php

     

    <?php

    class SMTPClient

    {

     

    function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)

    {

     

    $this->SmtpServer = $SmtpServer;

    $this->SmtpUser = base64_encode ($SmtpUser);

    $this->SmtpPass = base64_encode ($SmtpPass);

    $this->from = $from;

    $this->to = $to;

    $this->subject = $subject;

    $this->body = $body;

     

    if ($SmtpPort == "")

    {

    $this->PortSMTP = 25;

    }

    else

    {

    $this->PortSMTP = $SmtpPort;

    }

    }

     

    function SendMail ()

    {

    if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))

    {

    fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n");

    $talk["hello"] = fgets ( $SMTPIN, 1024 );

    fputs($SMTPIN, "auth login\r\n");

    $talk["res"]=fgets($SMTPIN,1024);

    fputs($SMTPIN, $this->SmtpUser."\r\n");

    $talk["user"]=fgets($SMTPIN,1024);

    fputs($SMTPIN, $this->SmtpPass."\r\n");

    $talk["pass"]=fgets($SMTPIN,256);

    fputs ($SMTPIN, "MAIL FROM: <".$this->from.">\r\n");

    $talk["From"] = fgets ( $SMTPIN, 1024 );

    fputs ($SMTPIN, "RCPT TO: <".$this->to.">\r\n");

    $talk["To"] = fgets ($SMTPIN, 1024);

    fputs($SMTPIN, "DATA\r\n");

    $talk["data"]=fgets( $SMTPIN,1024 );

    fputs($SMTPIN, "To: <".$this->to.">\r\nFrom: <".$this->from.">\r\nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n");

    $talk["send"]=fgets($SMTPIN,256);

    //CLOSE CONNECTION AND EXIT ...

    fputs ($SMTPIN, "QUIT\r\n");

    fclose($SMTPIN);

    //

    }

    return $talk;

    }

    }

    ?>

     

     

    SMTPconfig.php

    <?php

    //Server Address

    $SmtpServer="www.myhost.com";

    $SmtpPort="25"; //default

    $SmtpUser="info@mydomain.com";

    $SmtpPass="password";

    ?>

     

     

     

     

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