Swift Mailer Auto Respond Problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
User avatar
gkwhitworth
Forum Commoner
Posts: 85
Joined: Tue Sep 05, 2006 8:28 pm
Location: Wasilla, Alaska

Swift Mailer Auto Respond Problems

Post by gkwhitworth »

The form works fine and it emails fine, well, it emails it fine to me. As you can see I have the recipients put into an array; and was trying to have the email address that was typed in by the user become one of the email addresses of the array. One of the problems I have run into with Swift is calling the variables. So far the only way I can get them to work is by concatenating the variables. I have tried everything, single quotes, double quotes, concatenation, no concatenation. Please Help.

Code: Select all

<? session_start();
header("Location: http://www.gkwinspired.com");
require('../Swift/Swift.php');
require('../Swift/Swift/Connection/SMTP.php');

$mailer = new Swift(new Swift_Connection_SMTP('0.0.0.0'));
$recipients = array ('hello@gkwinspired.com','.$email.');

if ($mailer->isConnected())

{
   $mailer->addPart ('This is plain text');
   $mailer->addPart ('
   
	<link rel="stylesheet" type="text/css" href="http://www.gkwinspired.com/Styles/fonts.css">
	<link rel="stylesheet" type="text/css" href="http://www.gkwinspired.com/Styles/sub_temps.css">
	<link rel="stylesheet" type="text/css" href="http://www.gkwinspired.com/Styles/nonFont.css">
	<link rel="stylesheet" type="text/css" href="http://www.gkwinspired.com/Styles/contact.css">

   
   <table width="637px" class="normal" cellspacing="0" cellpadding="3" align="center">
   
      <tr height="105px">
           <td colspan="2"><img src="http://www.gkwinspired.com/images/template/top.jpg">
           </td>
       </tr>
       
          	<tr>
                <td colspan="2"><h2>Personal Information</h2>
                </td>
            </tr>

	         <tr >
                <td width="10%" align="right" class="normal">Name:
                </td>

                <td width="90%" class="normal">'.$fname.' '.$lname.'
                </td>
            </tr>
            
            <tr>
                <td width="10%" align="right" class="normal">Email:
                </td>

                <td width="90%" class="normal">'.$email.'
                </td>
            </tr>
            
             <tr >
                <td width="10%" align="right" class="normal">Phone:
                </td>

                <td width="90%" class="normal">'.$phone.'
                </td>
            </tr>
            
            <tr>
                <td width="10%" align="right" class="normal">Address:
                </td>

                <td width="90%" class="normal">'.$address.'
                </td>
            </tr>
            
            <tr >
                <td width="10%" align="right" class="normal">City:
                </td>

                <td width="90%" class="normal">'.$city.'
                </td>
            </tr>
            
            <tr>
                <td width="10%" align="right" class="normal">State:
                </td>

                <td width="90%" class="normal">'.$state.'
                </td>
            </tr>
            
            <tr >
                <td width="10%" align="right" class="normal">Zip:
                </td>

                <td width="90%" class="normal">'.$zip.'
                </td>
            </tr>
            
            <tr>
                <td colspan="2"><h2>Order Information</h2>
                </td>
            </tr>
            
             <tr>
                <td width="10%" align="right" class="normal">Package:
                </td>

                <td width="90%" class="normal">'.$package.'
                </td>
            </tr>
            
             <tr >
                <td width="10%" align="right" class="normal">Flash:
                </td>

                <td width="90%" class="normal">'.$flash.'
                </td>
            
            </tr>
            
             <tr>
                <td width="10%" align="right" class="normal">PHP:
                </td>

                <td width="90%" class="normal">'.$phpForm.'
                </td>
            </tr>
            
             <tr >
                <td width="10%" align="right" class="normal">ASP:
                </td>

                <td width="90%" class="normal">'.$asp.'
                </td>
            
            </tr>
            
             <tr>
                <td width="10%" align="right" class="normal">CMS:
                </td>

                <td width="90%" class="normal">'.$cms.'
                </td>
         	</tr>
            
           <br>           
           <tr >
                <td width="10%" align="right" class="normal">Estimate:
                </td>

                <td width="90%" class="normal">'.$answer.'
                
                </td>
            </tr>          
   			<br>
           	<br>
       <tr height="65px">
           <td colspan="2"><img src="http://www.gkwinspired.com/images/template/bottom.jpg">
           </td>
       </tr>

   </table>','text/html');
   $mailer->send(
        $recipients,
        '"Greg Whiworth" <hello@gkwinspired.com>',
        'Web Order');

   $mailer->close();
}
else echo "The mailer failed to connect. Errors: <pre>".print_r($mailer->errors, 1)."</pre><br />
    Log: <pre>".print_r($mailer->transactions, 1)."</pre>";

?>
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Check out the original thread you posted regarding this problem.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You're still using single quotes to place variables in. If there is no other psrts to the stirng don't use quotes at all and it will be faster. It's not anything to do with Swift Mailer just for the record ;)
Locked