Jump to content

Acknowledged74

New Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by Acknowledged74

  1. Hi

     

    We have a nicely working smtp contact form, however the form redirects to the contact.php file as default I presume, when we want it to go to a thank you page. Can you [please take a look at the code below and clarify where I need to put the thank you page URL;

     

    $redirect_url = "http://".$_SERVER['SERVER_NAME']; //Redirect URL after submit the form

    $mail->From = $mail->Username;    //Default From email same as smtp user
    $mail->FromName = "Mobile website";

    $mail->AddAddress("essexcarrentals@yahoo.co.uk", "Mobile Website"); //Email address where you wish to receive/collect those emails.

    $mail->WordWrap = 50;                                 // set word wrap to 50 characters
    $mail->IsHTML(true);                                  // set email format to HTML

    $mail->Subject = $_POST['Enquiry'];
    $message = "Name: ".$_POST['name']." \r\n <br>Email Address: ".$_POST['email']." \r\n <br> Phone: ".$_POST['phone']." \r\n <br> Vehicle: ".$_POST['select']." \r\n <br> Dates: ".$_POST['dates'];
    $mail->Body    = $message;

    if(!$mail->Send())
    {
       echo "Message could not be sent. <p>";
       echo "Mailer Error: " . $mail->ErrorInfo;
       exit;
    }

    echo "Message has been sent";
    header("Location: $redirect_url");
    }
    ?>

     

    I have tried replacing the http:// but this returns a page underfined error on submission?

     

    We appreciate your help on this one guys :0)

     

    Ash

     

    ---

  2. Hi

    I have a simply working SMTP form, however I need this to send to a yahoo.com email address, what can I add to achieve this?

    SmtpConfig.php
    ==============

    <?php
    //Server Address
    $SmtpServer="91.186.30.25";
    $SmtpPort="25"; //default
    $SmtpUser="things@wilsoncarandvanrental.co.uk";
    $SmtpPass="things123";
    ?>

    SmtpClass.php
    =============

    <?php
    class SMTPClient
    {
    // A function for Setting up SMTP
    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;


    //Setting Default port Value
    if ($SmtpPort == "")
    {
    $this->PortSMTP = 25;
    }
    else
    {
    $this->PortSMTP = $SmtpPort;
    }
    }

    //Sending the Mail
    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;
    }
    }
    ?>



    mail.php
    ========

    <?php

    //Include Class And Config
    include('SmtpConfig.php');
    include('SmtpClass.php');

    //Check the Request Method
    if($_SERVER["REQUEST_METHOD"] == "POST")
    {
    $to = $_POST['to'];
    $from = $_POST['from'];
    $subject = $_POST['sub'];
    $body = $_POST['message'];
    // Send the mail Using the class
    $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
    $SMTPChat = $SMTPMail->SendMail();
    }
    // After Exit, show the form
    ?>
    <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>

    Probably quite straight form, but of course I don#t know how :0)

    Much appreciated.

  3. Hi

    I have a Wordpress setup and theme running nicely. I want to add a shop and Woocommerce has been recommended as the right way to go, so I've installed that nice and easy, but it doesn't work with my theme.

    I found this,

    http://wcdocs.woothemes.com/codex/third ... atibility/

    I am trying to implement the hook. But I'm struggling as I find the instructions unclear.

    I'm sure this doesn't need any past knowledge of Woocommerce just of php.

    I've added the following to line 31 of the function.php file

    add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
    add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

    function my_theme_wrapper_start() {
    echo '<section id="maincontent">';
    }

    function my_theme_wrapper_end() {
    echo '</section>';
    }

    which to be honest is just area of the function.php with a gap. I've copied the function.php content into a Word doc linked to below.

    http://www.smarterbarcodes.co.uk/phpcontent.docx

    Any help on this would be great, Woo won't help until you have bought additional extensions, but if I can't get it to work, why should I?

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