Close
Login to Your Account


Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Status
    Offline
    mie_kkm's Avatar
    Gempak Newbie
    Join Date
    Jan 2012
    Posts
    36
    Mentioned
    0 Post(s)

    Default Coding PHP untuk hantar email apabila tekan Submit/Hantar

    salam.... ada tak sapa2 yg penah buat coding untuk php bila kita isi form dan tekan butang simpan/hantar/submit data dalam form tu akan simpan dalam database, so untuk admin tahu bahawa ada org isi form tu satu email akan sampai kat admin... faham x ayat??? bila tekan butang simpan/submit satu email akan dihantar kepada admin bahawa ada org mengisi form tu.... harap paham la deh... ingin bantuan dari korang semua...



  2. # ADS
    Circuit advertisement
    Join Date
    Always
    Posts
    Many
     

  3. #2
    Status
    Offline
    honey235's Avatar
    Gempak Newbie
    Join Date
    Feb 2010
    Posts
    7
    Mentioned
    0 Post(s)

    Default

    sy penah gune phpmailer utk send email(utk PHP je tau).email bole cc ke email admin..mgkin bole tgk tutorial die n download class die..simple n mudah bg sy..hehe

  4. #3
    Status
    Offline
    duelist's Avatar
    Gempak Newbie
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)

    Default

    contoh mudah:

    if($_POST) {
    $name = $_POST[name];
    $from_email = $_POST[email];
    $to_email = 'admin@example.com';
    $subject = 'Someone has filled the form';
    $message = 'Someone has filled the form from your website';
    $headers = "From:$name<$from_email>";
    mail($to_email,$subject,$message,$headers);
    }

  5. #4
    Status
    Offline
    mie_kkm's Avatar
    Gempak Newbie
    Join Date
    Jan 2012
    Posts
    36
    Mentioned
    0 Post(s)

    Default

    Quote @honey235 View Post
    sy penah gune phpmailer utk send email(utk PHP je tau).email bole cc ke email admin..mgkin bole tgk tutorial die n download class die..simple n mudah bg sy..hehe
    mana totorial yg dimaksudkan tu....

  6. #5
    Status
    Offline
    mie_kkm's Avatar
    Gempak Newbie
    Join Date
    Jan 2012
    Posts
    36
    Mentioned
    0 Post(s)

    Default

    Quote @duelist View Post
    contoh mudah:

    if($_POST) {
    $name = $_POST[name];
    $from_email = $_POST[email];
    $to_email = 'admin@example.com';
    $subject = 'Someone has filled the form';
    $message = 'Someone has filled the form from your website';
    $headers = "From:$name<$from_email>";
    mail($to_email,$subject,$message,$headers);
    }
    coding ni nak telak kat mana ni?????

  7. #6
    Status
    Offline
    honey235's Avatar
    Gempak Newbie
    Join Date
    Feb 2010
    Posts
    7
    Mentioned
    0 Post(s)

    Default

    include ("email/class.phpmailer.php");

    try {
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Mailer = "smtp";
    $mail->Host = "ssl://smtp.gmail.com";<--contoh klu gne gmail
    $mail->Port = 465;
    $mail->SMTPAuth = true;
    $mail->Username = "user@gmail.com";
    $mail->Password = "pwd";<--pwd email
    $mail->From = "email_from@gmail.com";
    $mail->FromName = "name";
    $mail->AddAddress(email, nama);<--set email n nama penerima
    $mail->AddCC("admin@gmail.com","description");<-- cc to email admin
    $mail->WordWrap = 100;
    $mail->IsHTML(true);
    $mail->Subject = "Title email";
    $mail->Body = "content email.";
    $mail->AddAttachment("attachment_file");<-- bole gune function if nk attach doc
    if($mail->Send())
    {
    echo mainpage;
    }

    } catch (phpmailerException $e) {

    echo $e->errorMessage();

    }

    class utk phpmailer tu kene donlod la ye..hopefully ade idea la nk wat cane..

  8. #7
    Status
    Offline
    mie_kkm's Avatar
    Gempak Newbie
    Join Date
    Jan 2012
    Posts
    36
    Mentioned
    0 Post(s)

    Default

    Quote @honey235 View Post
    include ("email/class.phpmailer.php");

    try {
    $mail = new PHPMailer();
    $mail->IsSMTP();
    $mail->Mailer = "smtp";
    $mail->Host = "ssl://smtp.gmail.com";<--contoh klu gne gmail
    $mail->Port = 465;
    $mail->SMTPAuth = true;
    $mail->Username = "user@gmail.com";
    $mail->Password = "pwd";<--pwd email
    $mail->From = "email_from@gmail.com";
    $mail->FromName = "name";
    $mail->AddAddress(email, nama);<--set email n nama penerima
    $mail->AddCC("admin@gmail.com","description");<-- cc to email admin
    $mail->WordWrap = 100;
    $mail->IsHTML(true);
    $mail->Subject = "Title email";
    $mail->Body = "content email.";
    $mail->AddAttachment("attachment_file");<-- bole gune function if nk attach doc
    if($mail->Send())
    {
    echo mainpage;
    }

    } catch (phpmailerException $e) {

    echo $e->errorMessage();

    }

    class utk phpmailer tu kene donlod la ye..hopefully ade idea la nk wat cane..
    sy rasa bukan yg cam nii sy nak....
    yg saya tengah cari coding untuk :
    contoh:
    form komen dalam web, pengguna akan isi form tu and akan simpan dalam database, setelah pengguna tekan submit/simpan email akan dihantar kepada anmin memberitahu bahawa ada pengguna isi form komen tersebut.

  9. #8
    Status
    Offline
    duelist's Avatar
    Gempak Newbie
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)

    Default

    Quote @mie_kkm View Post
    coding ni nak telak kat mana ni?????
    kt file form tu.klu ko guna html, set <?php copy_code_kt_sini ?> bole letak kt bhg atas sekali file html tu.
    klu form guna php, just letak kt bhg atas slps include klu ada.
    ni yg biasa aku buat.bole jugak letak mana2 yg sesuai.yg penting kene dlm lingkungan <?php ?>
    Last edited by duelist; 20-07-2012 at 08:51 AM.

  10. #9
    Status
    Offline
    shaggy's Avatar
    Gempak Newbie
    Join Date
    Aug 2010
    Posts
    1
    Mentioned
    0 Post(s)

    Default

    Assalamualaikum..saya nak membantu..juz nk confirmkan balik situasi..satu form yang diisi oleh user kemudian disimpan didalam database..dalam masa yang sama, sistem akan hantar satu email kpd admin mengatakan ada form yang baru diisi..guna coding php,kan? duduk area mana? klau bleh bg coding form kat email saya, saya boleh alterkan..

  11. #10
    Status
    Offline
    kiwiceri's Avatar
    Gempak Junior
    Join Date
    Oct 2011
    Posts
    91
    Mentioned
    0 Post(s)

    Default

    cmni k? aq test2 j..




    <?php $MAiLcommt ?>
    <form>
    <input type='submit' class='btn' name='Send_Form' value='Submit'>
    </form>


    //setting email if $SendEnqkMAiL berjaye

    <?php
    function SendEnqkMAiL($SendBy,$info) {
    $SendMaiLTO = "foooo@gmail.com";
    $Subject = "submit fooo";
    $message = preg_replace("/<br[[:space:]]*\/?[[:space:]]*>/i","\n",$info);
    $Header = "From: $systemMAIL" . "\r\n"
    . "Reply-To: $SendBy" . "\r\n"
    . "Return-Path: $SendBy" . "\r\n"
    . "Content-type: text/plain; charset=ISO-8859-1" . "\r\n";





    mail($SendMaiLTO,$Subject,$message,$Header);
    }


    //check input data dari form

    if (isset($_POST['Send_Form']))
    {
    $customer = (isset($_POST['customer'])) ? $_POST['customer'] : NULL;
    $custmail = (isset($_POST['custmail'])) ? $_POST['custmail'] : NULL;



    $FeedMSG = "Someone have submit form"."\n". "Sender: " . $customer . "\n" .
    "Reply-To: " . $custmail . "\n"
    ;

    if ($customer=="" && $custmail=="" ) {
    $MAiLerror = 1;
    $MAiLcommt .= "<div> You did not enter the required fields</div>";
    }
    else {
    SendEnqkMAiL($custmail,$FeedMSG);
    $MAiLcommt = "<div">Thank you!</div>";
    }
    ?>

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

User Tag List

Posting Permissions

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