www.webdeveloper.com
Page 1 of 5 123 ... LastLast
Results 1 to 15 of 65

Thread: [RESOLVED] PHP mail() not sending

  1. #1
    Join Date
    Sep 2008
    Posts
    120

    resolved [RESOLVED] PHP mail() not sending

    Hi.
    I use the mail() function to send out am email.
    When I put a simple and short string the bodymail, I get the letter.
    When I put a very long HTML code, I get nothing. I tried first escaping the string with addslashes(), but it again didn't work.
    I get no errors evem when I put
    PHP Code:
    error_reporting(E_ALL); 
    , smiply the message is not sent!
    Do you have any ideas?
    Here goes the HTML string I use in the code:
    Code:
    <table width="650" cellspacing="0" cellpadding="0" border="0" align="center">
        <tbody>
            <tr>
                <td bgcolor="#eee6d9" colspan="5">
                <p style="color: rgb(153, 0, 0); font-family: Verdana,Geneva,sans-serif; font-size: 11px; padding-left: 15px;">You have got an Iquiry from one of our costumers<br />
                If you are having trouble reading this email please log in to your account<a style="font-family: Verdana,Geneva,sans-serif; color: rgb(56, 74, 134); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">.</a></p>
                </td>
                <td><img height="56" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
            </tr>
            <tr>
                <td bgcolor="#f7f2e6" colspan="3"><img height="55" width="442" border="0" alt="" id="n08mcburgundy_r2_c1" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/08-mc-burgundy_r2_c1.png" name="n08mcburgundy_r2_c1" /></td>
                <td bgcolor="#f7f2e6" colspan="2"><img height="55" width="208" border="0" alt="Your Company Logo" id="n08mcburgundy_r2_c4" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/logo.png" name="n08mcburgundy_r2_c4" /></td>
                <td><img height="55" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
            </tr>
            <tr>
                <td height="31" width="647" bgcolor="#f7f2e6" colspan="5"><a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px; padding-left: 15px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Back Issues</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Article Archive</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Resource Center</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Request Demo</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">example.com</a></td>
                <td><img height="31" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
            </tr>
            <tr>
                <td bgcolor="#f7f2e6">&nbsp;</td>
                <td valign="top" bgcolor="#f7f2e6">
                <h1 style="font-family: Arial,Helvetica,sans-serif; color: rgb(146, 139, 119); font-size: 18px;">IN THIS ISSUE:</h1>
                <h2>&nbsp;</h2>
                <font color="#808080"><span style="font-weight: bold;">
                <h2>Hello {{firstname}} {{lastname}},</h2>
                <h2>You have an inquiry from {{country}} on your property.</h2>
                <h2>The following is added.</h2>
                <h2>Arrival date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{arrival_date}}</h2>
                <h2>Departure date&nbsp;&nbsp; {{departure_date}}</h2>
                <h2>Total party size&nbsp;&nbsp; {{with_children}}</h2>
                <h2>with&nbsp; {{only_children}}&nbsp; Children</h2>
                </span><br />
                </font>
                <p><a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;" href="http://4homesonly.com" target="_blank">Please check the availability of your property here:</a><br />
                </p>
                <p style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;">MESSAGE:<br />
                <br />
                {{message}}<a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; text-align: right; color: rgb(153, 0, 0);" href="mailto:address@email.com"><br />
                </a></p>
                </td>
                <td colspan="2">&nbsp;</td>
                <td height="380" width="28" bgcolor="#f7f2e6"><a href="/userfiles/image/Active holiday Boy with fish.jpg"><img height="342" width="232" src="/userfiles/image/Active holiday Boy with fish.jpg" alt="boy" /></a></td>
                <td><img height="380" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
            </tr>
            <tr>
                <td bgcolor="#f7f2e6" rowspan="2">&nbsp;</td>
                <td bgcolor="#f7f2e6" colspan="3">
                <h1 style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Featured Products</h1>
                <p style="color: rgb(146, 139, 119); font-size: 12px; font-family: arial,verdana,sans-serif;">Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasellus dui non magna commodo nascetur ridiculus           volutpat porttitor. <br />
                Ullamcorper sed, lobortis pretium, mi. Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasell.</p>
                </td>
                <td height="407" width="28" bgcolor="#f7f2e6" rowspan="2">&nbsp;</td>
                <td><img height="124" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
            </tr>
            <tr>
                <td valign="top" bgcolor="#f7f2e6" colspan="3">
                <h1 style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Email Admin Center</h1>
                <p style="font-family: arial,verdana,sans-serif; color: rgb(146, 139, 119); font-size: 12px;">This newsletter is a service of Example.com. Should you no longer wish to receive these messages please go here to unsubscribe or send an email to: unsubscribe-929@example.com <br />
                <br />
                To ensure delivery of this newsletter to your inbox and to enable images to load in future mailings, please add admincenter@example.com to your e-mail address book or safe senders list. You are receiving this email at yourname@example.com.<br />
                <a style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#"><br />
                Update Your Profile</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Web Version</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe to Name</a></p>
                </td>
            </tr>
        </tbody>
    </table>
    10x in advance

  2. #2
    Join Date
    Apr 2008
    Posts
    171
    Can you show us the php mail headers you are using. In order to effectively get html into an email message using mail() you will need to have the proper multipart structure and mime settings.

    We can take a look by starting with your php sendmail script.

  3. #3
    Join Date
    Sep 2008
    Posts
    120
    PHP Code:
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"

  4. #4
    Join Date
    Apr 2008
    Posts
    171
    That's what I thought it would look like.

    Been here along time ago and it took me a while (weeks/months) to solve the problem and get it to work.

    Basically, you need to create and run the php script to produce a multipart mail message.

    I have code to do it. Hang on and I will retrieve it for you and post here within the next half hour.
    Last edited by devel95; 02-10-2010 at 09:40 AM.

  5. #5
    Join Date
    Sep 2008
    Posts
    120
    OK, 10x man

  6. #6
    Join Date
    Apr 2008
    Posts
    171
    PHP Code:
    <?php

    /*
     * I pulled this out of a function and dumbed it down a bit (keeping it basic) -- just populate 
     * all the $GLOBALS and you'll be good to go. Here's the $GLOBALS list:
     *   $GLOBALS['recipientsName']            :: name of person to receive message (optional)
     *   $GLOBALS['recipientsEmailAddress']    :: email address of person to receive message
     *   $GLOBALS['fromName']                :: name of person sending message (optional)
     *   $GLOBALS['fromEmailAddress']        :: email address of person sending message
     *   $GLOBALS['replyToName']            :: reply to persons name (optional)
     *   $GLOBALS['replyToEmailAddress']    :: reply to email address (can be different from sender's email address)
     *   $GLOBALS['ccList']                    :: list of email address for cc purposes (optional) -- separate by commas
     *   $GLOBALS['bccList']                :: list of email address for bcc purposes (optional) -- separate by commas
     *   $GLOBALS['attachment']                :: file attachment (optional)
     *   $GLOBALS['plainTextVersion']        :: the plain text version of the message
     *   $GLOBALS['htmlVersion']            :: the html equivalent version of the message
     *   $GLOBALS['applicationType']        :: application mime type  (optional)
     *                                            'application/msword' for doc and docx files
     *                                            'application/vnd.ms-excel' for csv, xls and xlsx files
     *                                            'application/pdf' for pdf files
     *                                        this is all I have tested
     *   $GLOBALS['attachFileName']            :: name of file attachment (optional)
     *   $GLOBALS['subject']                :: message subject
     */

        // create multipart boundries
        
    $mime_boundary_alt 'Multipart-Alternative-Boundary_'.md5(date('r',time()));
        
    $mime_boundary_mix 'Multipart-Mixed-Boundary_'.md5(date('r',time()));

        
    // setup email headers and body message
        
    $to $GLOBALS['recipientsName'].' <'.$GLOBALS['recipientsEmailAddress'].'>';
        
    $headers $message '';
        
    $headers .= 'From: '.$GLOBALS['fromName'].' <'.$GLOBALS['fromEmailAddress'].'>'."\n\n";
        
    $headers .= 'Reply-To: '.$GLOBALS['replyToName'].' <'.$GLOBALS['replyToEmailAddres'].'>'."\n\n";
        
    $headers .= 'Return-Path: '.$GLOBALS['replyToEmailAddress']."\n\n";
        if (isset(
    $GLOBALS['ccList']) && !empty($GLOBALS['ccList'])) $headers .= 'CC: '.$GLOBALS['ccList']."\n\n";
        if (isset(
    $GLOBALS['bccList']) && !empty($GLOBALS['bccList'])) $headers .= 'BCC: '.$GLOBALS['bccList']."\n\n";
        
    $headers .= 'MIME-Version: 1.0'."\n";
        if (isset(
    $GLOBALS['attachment']) && !empty($GLOBALS['attachment'])) {
            
    $headers .= 'Content-Type: multipart/mixed;  boundary="'.$mime_boundary_mix.'"'."\n\n";
            
    $message .= '--'.$mime_boundary_mix."\n";
            
    $message .= 'Content-Type: multipart/alternative;  boundary="'.$mime_boundary_alt.'"'."\n";
        }
        else 
    $headers .= 'Content-Type: multipart/alternative;  boundary="'.$mime_boundary_alt.'"'."\n";
        
    $message .= 'This is a multi-part message in MIME format.'."\n";
        
    $message .= '--'.$mime_boundary_alt."\n";
        
    $message .= 'Content-Type: text/plain; charset="iso-8859-1"'."\n";
        
    $message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
        
    $message .= $GLOBALS['plainTextVersion']."\n\n";
        
    $message .= "--".$mime_boundary_alt."\n";
        
    $message .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
        
    $message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
        
    $message .= $GLOBALS['htmlVersion']."\n\n";
        
    $message .= '--'.$mime_boundary_alt.'--'."\n";
        if (isset(
    $GLOBALS['attachment']) && !empty($GLOBALS['attachment'])) {
            
    $message .= '--'.$mime_boundary_mix."\n";
            
    $message .= 'Content-Type: '.$GLOBALS['applicationType'].'; name="'.$GLOBALS['attachFileName'].'"'."\n";
            
    $message .= 'Content-Transfer-Encoding: base64'."\n";
            
    $message .= 'Content-Disposition: attachment; filename="'.$GLOBALS['attachFileName'].'"'."\n\n";
            
    $message .= $GLOBALS['attachment']."\n\n";
            
    $message .= '--'.$mime_boundary_mix.'--'."\n";
        }
        
    $returnPath " -f ".$GLOBALS['replyToEmailAddress'];

        
    // send the message
        
    mail($to,$GLOBALS['subject'],$message,$headers,$returnPath);


    ?>

  7. #7
    Join Date
    Sep 2008
    Posts
    120
    wow! Incredible... 10x a lot man, I will test this monster now

  8. #8
    Join Date
    Apr 2008
    Posts
    171
    P.S. you might wish to edit the title of this thread and add "HTML" to it just in case others search this forum with similar issues. Good luck. Let us know how you make out.
    Last edited by devel95; 02-10-2010 at 09:39 AM.

  9. #9
    Join Date
    Sep 2008
    Posts
    120

    Exclamation

    Nothing...
    PHP Code:
    <?php

    /*
    * I pulled this out of a function and dumbed it down a bit (keeping it basic) -- just populate
    * all the $GLOBALS and you'll be good to go. Here's the $GLOBALS list:
    *   $GLOBALS['recipientsName']            :: name of person to receive message (optional)
    *   $GLOBALS['recipientsEmailAddress']    :: email address of person to receive message
    *   $GLOBALS['fromName']                :: name of person sending message (optional)
    *   $GLOBALS['fromEmailAddress']        :: email address of person sending message
    *   $GLOBALS['replyToName']            :: reply to persons name (optional)
    *   $GLOBALS['replyToEmailAddress']    :: reply to email address (can be different from sender's email address)
    *   $GLOBALS['ccList']                    :: list of email address for cc purposes (optional) -- separate by commas
    *   $GLOBALS['bccList']                :: list of email address for bcc purposes (optional) -- separate by commas
    *   $GLOBALS['attachment']                :: file attachment (optional)
    *   $GLOBALS['plainTextVersion']        :: the plain text version of the message
    *   $GLOBALS['htmlVersion']            :: the html equivalent version of the message
    *   $GLOBALS['applicationType']        :: application mime type  (optional)
    *                                            'application/msword' for doc and docx files
    *                                            'application/vnd.ms-excel' for csv, xls and xlsx files
    *                                            'application/pdf' for pdf files
    *                                        this is all I have tested
    *   $GLOBALS['attachFileName']            :: name of file attachment (optional)
    *   $GLOBALS['subject']                :: message subject
    */

        // create multipart boundries

    $recipientsName "Me";
    $recipientsEmailAddress "admin@livescore-bg.net";
    $subject "naslov";
        
    $mime_boundary_alt 'Multipart-Alternative-Boundary_'.md5(date('r',time()));
        
    $mime_boundary_mix 'Multipart-Mixed-Boundary_'.md5(date('r',time()));

        
    // setup email headers and body message
        
    $to $GLOBALS['recipientsName'].' <'.$GLOBALS['recipientsEmailAddress'].'>';
        
    $headers $message '';
        
    $headers .= 'From: '.$GLOBALS['fromName'].' <'.$GLOBALS['fromEmailAddress'].'>'."\n\n";
        
    $headers .= 'Reply-To: '.$GLOBALS['replyToName'].' <'.$GLOBALS['replyToEmailAddres'].'>'."\n\n";
        
    $headers .= 'Return-Path: '.$GLOBALS['replyToEmailAddress']."\n\n";
        if (isset(
    $GLOBALS['ccList']) && !empty($GLOBALS['ccList'])) $headers .= 'CC: '.$GLOBALS['ccList']."\n\n";
        if (isset(
    $GLOBALS['bccList']) && !empty($GLOBALS['bccList'])) $headers .= 'BCC: '.$GLOBALS['bccList']."\n\n";
        
    $headers .= 'MIME-Version: 1.0'."\n";
        if (isset(
    $GLOBALS['attachment']) && !empty($GLOBALS['attachment'])) {
            
    $headers .= 'Content-Type: multipart/mixed;  boundary="'.$mime_boundary_mix.'"'."\n\n";
            
    $message .= '--'.$mime_boundary_mix."\n";
            
    $message .= 'Content-Type: multipart/alternative;  boundary="'.$mime_boundary_alt.'"'."\n";
        }
        else 
    $headers .= 'Content-Type: multipart/alternative;  boundary="'.$mime_boundary_alt.'"'."\n";
        
    $message .= 'This is a multi-part message in MIME format.'."\n";
        
    $message .= '--'.$mime_boundary_alt."\n";
        
    $message .= 'Content-Type: text/plain; charset="iso-8859-1"'."\n";
        
    $message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
        
    $message .= $GLOBALS['plainTextVersion']."\n\n";
        
    $message .= "--".$mime_boundary_alt."\n";
        
    $message .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
        
    $message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
        
    $message .= $GLOBALS['htmlVersion']."\n\n";
        
    $message .= '--'.$mime_boundary_alt.'--'."\n";
        if (isset(
    $GLOBALS['attachment']) && !empty($GLOBALS['attachment'])) {
            
    $message .= '--'.$mime_boundary_mix."\n";
            
    $message .= 'Content-Type: '.$GLOBALS['applicationType'].'; name="'.$GLOBALS['attachFileName'].'"'."\n";
            
    $message .= 'Content-Transfer-Encoding: base64'."\n";
            
    $message .= 'Content-Disposition: attachment; filename="'.$GLOBALS['attachFileName'].'"'."\n\n";
            
    $message .= $GLOBALS['attachment']."\n\n";
            
    $message .= '--'.$mime_boundary_mix.'--'."\n";
        }
        
    $returnPath " -f ".$GLOBALS['replyToEmailAddress'];
        
    $message .= "HERE GOES SOME HTML";
    //$to = "admin@livescore-bg.net";
        // send the message
        
    echo $to .'<Br>'$GLOBALS['subject'] .'<Br>'.  $message '<Br>'$headers '<Br>'$returnPath;
        
    mail($to,$GLOBALS['subject'],$message,$headers$returnPath);


    ?>
    When I remove the $headers from the mail() arguments it works (of course not sending as HTML but as plain text).
    Otherwise I get an error:
    Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/r/i/c/rickschram/html/www.4homesonly.com/pun.php on line 72

    Ideas?

  10. #10
    Join Date
    Sep 2008
    Posts
    120
    And btw where can I change the title of the thread from?

  11. #11
    Join Date
    Apr 2008
    Posts
    171
    Ok,

    First...the $headers variable must be present. Don't remove it.

    Secondly, you need to populate the $GLOBALS[] variables not like this:
    $recipientsName = "Me";
    $recipientsEmailAddress = "admin@livescore-bg.net";
    $subject = "naslov";

    but actually like this:
    $GLOBALS['recipientsName'] = "Me";
    $GLOBALS['recipientsEmailAddress'] = "admin@livescore-bg.net";
    $GLOBALS['subject'] = "naslov";

    Also, put something relevant inside these double quotes:
    $GLOBALS['fromName'] = "a name";
    $GLOBALS['fromEmailAddress'] = "an email address";
    $GLOBALS['plainTextVersion'] = "the plain text copy of your message";
    $GLOBALS['htmlVersion'] = "the html formatted copy of your message";

  12. #12
    Join Date
    Apr 2008
    Posts
    171
    Quote Originally Posted by pastet89 View Post
    And btw where can I change the title of the thread from?
    Ignore this post...I see this forum does not allow editing of the title of a thread.

  13. #13
    Join Date
    Sep 2008
    Posts
    120
    Can you tell me what to put here:
    $GLOBALS['plainTextVersion'] = "the plain text copy of your message";
    $GLOBALS['htmlVersion'] = "the html formatted copy of your message";

  14. #14
    Join Date
    Apr 2008
    Posts
    171
    Sure, just copy and paste the 2 $GLOBAL variables below inserting them at the top of your PHP script. Bear in mind, that these 2 variables will contain the body of your message:
    • 1 is a Plain Text Version (for those email clients that do not accept html email messages
    • and the other is the HTML Version of your message


    $GLOBALS['plainTextVersion'] = 'You have got an Iquiry from one of our costumers

    If you are having trouble reading this email please log in to your account...';


    $GLOBALS['htmlVersion'] = '
    <table width="650" cellspacing="0" cellpadding="0" border="0" align="center">
    <tbody>
    <tr>
    <td bgcolor="#eee6d9" colspan="5">
    <p style="color: rgb(153, 0, 0); font-family: Verdana,Geneva,sans-serif; font-size: 11px; padding-left: 15px;">You have got an Iquiry from one of our costumers<br />
    If you are having trouble reading this email please log in to your account<a style="font-family: Verdana,Geneva,sans-serif; color: rgb(56, 74, 134); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">.</a></p>
    </td>
    <td><img height="56" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
    </tr>
    <tr>
    <td bgcolor="#f7f2e6" colspan="3"><img height="55" width="442" border="0" alt="" id="n08mcburgundy_r2_c1" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/08-mc-burgundy_r2_c1.png" name="n08mcburgundy_r2_c1" /></td>
    <td bgcolor="#f7f2e6" colspan="2"><img height="55" width="208" border="0" alt="Your Company Logo" id="n08mcburgundy_r2_c4" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/logo.png" name="n08mcburgundy_r2_c4" /></td>
    <td><img height="55" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
    </tr>
    <tr>
    <td height="31" width="647" bgcolor="#f7f2e6" colspan="5"><a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px; padding-left: 15px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Back Issues</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Article Archive</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Resource Center</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Request Demo</a> | <a style="font-family: Verdana,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 11px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">example.com</a></td>
    <td><img height="31" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
    </tr>
    <tr>
    <td bgcolor="#f7f2e6">&nbsp;</td>
    <td valign="top" bgcolor="#f7f2e6">
    <h1 style="font-family: Arial,Helvetica,sans-serif; color: rgb(146, 139, 119); font-size: 18px;">IN THIS ISSUE:</h1>
    <h2>&nbsp;</h2>
    <font color="#808080"><span style="font-weight: bold;">
    <h2>Hello {{firstname}} {{lastname}},</h2>
    <h2>You have an inquiry from {{country}} on your property.</h2>
    <h2>The following is added.</h2>
    <h2>Arrival date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{arrival_date}}</h2>
    <h2>Departure date&nbsp;&nbsp; {{departure_date}}</h2>
    <h2>Total party size&nbsp;&nbsp; {{with_children}}</h2>
    <h2>with&nbsp; {{only_children}}&nbsp; Children</h2>
    </span><br />
    </font>
    <p><a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;" href="http://4homesonly.com" target="_blank">Please check the availability of your property here:</a><br />
    </p>
    <p style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(153, 0, 0); font-weight: bold;">MESSAGE:<br />
    <br />
    {{message}}<a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; text-align: right; color: rgb(153, 0, 0);" href="mailto:address@email.com"><br />
    </a></p>
    </td>
    <td colspan="2">&nbsp;</td>
    <td height="380" width="28" bgcolor="#f7f2e6"><a href="/userfiles/image/Active holiday Boy with fish.jpg"><img height="342" width="232" src="/userfiles/image/Active holiday Boy with fish.jpg" alt="boy" /></a></td>
    <td><img height="380" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
    </tr>
    <tr>
    <td bgcolor="#f7f2e6" rowspan="2">&nbsp;</td>
    <td bgcolor="#f7f2e6" colspan="3">
    <h1 style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Featured Products</h1>
    <p style="color: rgb(146, 139, 119); font-size: 12px; font-family: arial,verdana,sans-serif;">Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasellus dui non magna commodo nascetur ridiculus volutpat porttitor. <br />
    Ullamcorper sed, lobortis pretium, mi. Lorem ipsum dolor sit amet, consect etuer adip iscing elit. Phasell.</p>
    </td>
    <td height="407" width="28" bgcolor="#f7f2e6" rowspan="2">&nbsp;</td>
    <td><img height="124" width="1" border="0" alt="" src="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/images/spacer.gif" /></td>
    </tr>
    <tr>
    <td valign="top" bgcolor="#f7f2e6" colspan="3">
    <h1 style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 14px; font-weight: bold;">Email Admin Center</h1>
    <p style="font-family: arial,verdana,sans-serif; color: rgb(146, 139, 119); font-size: 12px;">This newsletter is a service of Example.com. Should you no longer wish to receive these messages please go here to unsubscribe or send an email to: unsubscribe-929@example.com <br />
    <br />
    To ensure delivery of this newsletter to your inbox and to enable images to load in future mailings, please add admincenter@example.com to your e-mail address book or safe senders list. You are receiving this email at yourname@example.com.<br />
    <a style="font-family: Tahoma,Geneva,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#"><br />
    Update Your Profile</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Web Version</a> | <a style="font-family: arial,verdana,sans-serif; color: rgb(153, 0, 0); font-size: 12px;" href="file:///C:/Documents%20and%20Settings/Dick/Desktop/Email%20templates/08-mc-burgundy/index.htm#">Subscribe to Name</a></p>
    </td>
    </tr>
    </tbody>
    </table>
    ';


    Ok, let me know how you make out here.

  15. #15
    Join Date
    Sep 2008
    Posts
    120
    W8... Sorry for that question, I got it.. I filled the text of the message there of course, but now I again get the same error:
    Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/r/i/c/rickschram/html/www.4homesonly.com/pun.php on line 211


    PHP Code:
    <?php

    /*
    * I pulled this out of a function and dumbed it down a bit (keeping it basic) -- just populate
    * all the $GLOBALS and you'll be good to go. Here's the $GLOBALS list:
    *   $GLOBALS['recipientsName']            :: name of person to receive message (optional)
    *   $GLOBALS['recipientsEmailAddress']    :: email address of person to receive message
    *   $GLOBALS['fromName']                :: name of person sending message (optional)
    *   $GLOBALS['fromEmailAddress']        :: email address of person sending message
    *   $GLOBALS['replyToName']            :: reply to persons name (optional)
    *   $GLOBALS['replyToEmailAddress']    :: reply to email address (can be different from sender's email address)
    *   $GLOBALS['ccList']                    :: list of email address for cc purposes (optional) -- separate by commas
    *   $GLOBALS['bccList']                :: list of email address for bcc purposes (optional) -- separate by commas
    *   $GLOBALS['attachment']                :: file attachment (optional)
    *   $GLOBALS['plainTextVersion']        :: the plain text version of the message
    *   $GLOBALS['htmlVersion']            :: the html equivalent version of the message
    *   $GLOBALS['applicationType']        :: application mime type  (optional)
    *                                            'application/msword' for doc and docx files
    *                                            'application/vnd.ms-excel' for csv, xls and xlsx files
    *                                            'application/pdf' for pdf files
    *                                        this is all I have tested
    *   $GLOBALS['attachFileName']            :: name of file attachment (optional)
    *   $GLOBALS['subject']                :: message subject
    */

        // create multipart boundries

    $GLOBALS['recipientsName'] = "Me";
    $GLOBALS['recipientsEmailAddress'] = "admin@livescore-bg.net";
    $GLOBALS['subject'] = "naslov";

    $GLOBALS['fromName'] = "a name";
    $GLOBALS['fromEmailAddress'] = "jivko@abv.bg";
    $GLOBALS['plainTextVersion'] = <<<pp
    plain text
    pp;
    $GLOBALS['htmlVersion'] = <<<ppp
     <html>
    I AM HTML!!!!!
    </html>
    ppp;
        
    $mime_boundary_alt 'Multipart-Alternative-Boundary_'.md5(date('r',time()));
        
    $mime_boundary_mix 'Multipart-Mixed-Boundary_'.md5(date('r',time()));

        
    // setup email headers and body message
        
    $to $GLOBALS['recipientsName'].' <'.$GLOBALS['recipientsEmailAddress'].'>';
        
    $headers $message '';
        
    $headers .= 'From: '.$GLOBALS['fromName'].' <'.$GLOBALS['fromEmailAddress'].'>'."\n\n";
        
    $headers .= 'Reply-To: '.$GLOBALS['replyToName'].' <'.$GLOBALS['replyToEmailAddres'].'>'."\n\n";
        
    $headers .= 'Return-Path: '.$GLOBALS['replyToEmailAddress']."\n\n";
        if (isset(
    $GLOBALS['ccList']) && !empty($GLOBALS['ccList'])) $headers .= 'CC: '.$GLOBALS['ccList']."\n\n";
        if (isset(
    $GLOBALS['bccList']) && !empty($GLOBALS['bccList'])) $headers .= 'BCC: '.$GLOBALS['bccList']."\n\n";
        
    $headers .= 'MIME-Version: 1.0'."\n";
        if (isset(
    $GLOBALS['attachment']) && !empty($GLOBALS['attachment'])) {
            
    $headers .= 'Content-Type: multipart/mixed;  boundary="'.$mime_boundary_mix.'"'."\n\n";
            
    $message .= '--'.$mime_boundary_mix."\n";
            
    $message .= 'Content-Type: multipart/alternative;  boundary="'.$mime_boundary_alt.'"'."\n";
        }
        else 
    $headers .= 'Content-Type: multipart/alternative;  boundary="'.$mime_boundary_alt.'"'."\n";
        
    $message .= 'This is a multi-part message in MIME format.'."\n";
        
    $message .= '--'.$mime_boundary_alt."\n";
        
    $message .= 'Content-Type: text/plain; charset="iso-8859-1"'."\n";
        
    $message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
        
    $message .= $GLOBALS['plainTextVersion']."\n\n";
        
    $message .= "--".$mime_boundary_alt."\n";
        
    $message .= 'Content-Type: text/html; charset="iso-8859-1"'."\n";
        
    $message .= 'Content-Transfer-Encoding: 8bit'."\n\n";
        
    $message .= $GLOBALS['htmlVersion']."\n\n";
        
    $message .= '--'.$mime_boundary_alt.'--'."\n";
        if (isset(
    $GLOBALS['attachment']) && !empty($GLOBALS['attachment'])) {
            
    $message .= '--'.$mime_boundary_mix."\n";
            
    $message .= 'Content-Type: '.$GLOBALS['applicationType'].'; name="'.$GLOBALS['attachFileName'].'"'."\n";
            
    $message .= 'Content-Transfer-Encoding: base64'."\n";
            
    $message .= 'Content-Disposition: attachment; filename="'.$GLOBALS['attachFileName'].'"'."\n\n";
            
    $message .= $GLOBALS['attachment']."\n\n";
            
    $message .= '--'.$mime_boundary_mix.'--'."\n";
        }
        
    $returnPath " -f ".$GLOBALS['replyToEmailAddress'];
        
    $message .= "HERE GOES SOME HTML";
    //$to = "admin@livescore-bg.net";
        // send the message
        
    echo $to .'<Br>'$GLOBALS['subject'] .'<Br>'.  $message '<Br>'$headers '<Br>'$returnPath;
        
    mail($to,$GLOBALS['subject'],$message,$headers$returnPath);


    ?>
    Last edited by pastet89; 02-10-2010 at 10:43 AM.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles