close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

what part of this script do I edit to get the message that arrives to look normal ?

Thread began 10/07/2009 6:01 pm by mikeybabe | Last modified 10/10/2009 8:56 am by mikeybabe | 3195 views | 10 replies |

mikeybabe

what part of this script do I edit to get the message that arrives to look normal ?

<?php
$MailAttachments = "";
$MailBCC = "";
$MailCC = "";
$MailTo = "";
$MailBodyFormat = "";
$MailBody = "";
$MailImportance = "";
$MailFrom = "potential client|WA|mehd@hnw7.com";
$MailSubject = "sent from nathan ormsby limited web site";
$_SERVER["QUERY_STRING"] = "";

//Global Variables

$WA_MailObject = WAUE_Definition("mail.nathanormsbyltd.com","25","mehd@hnw7.com","Nathan Ormsby Limited","","");

if ($RecipientEmail) {
$WA_MailObject = WAUE_AddRecipient($WA_MailObject,$RecipientEmail);
}
else {
//To Entries
}

//Attachment Entries

//BCC Entries

//CC Entries

//Body Format
$WA_MailObject = WAUE_BodyFormat($WA_MailObject,0);

//Set Importance
$WA_MailObject = WAUE_SetImportance($WA_MailObject,"3");

//Start Mail Body
$MailBody = $MailBody . "";
foreach( $_POST as $pkey => $pval ) {
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . (str_replace("_"," ",$pkey).": ".($pval));
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . "\r\n";
}
$MailBody = $MailBody . "";
//End Mail Body

$WA_MailObject = WAUE_SendMail($WA_MailObject,$MailAttachments,$MailBCC,$MailCC,$MailTo,$MailImportance,$MailFrom,$MailSubject,$MailBody);

$WA_MailObject = null;
?>

Is it " Start Mail Body ? "

Sign in to reply to this post

Ray BorduinWebAssist

replace: .($pval)

with: .str_replace("\n","<BR />",$pval)

Sign in to reply to this post

mikeybabe

this does not work

your syntax must be wrong ?

Sign in to reply to this post

Ray BorduinWebAssist

My syntax is correct. I copied and pasted it from a working page that is part of our html contact form solution. You must have replaced it wrong. What does your script look like now? What is the error you are getting?

Sign in to reply to this post

mikeybabe

Hi Ray

this is what I typed in

$MailBody = $MailBody . (str_replace("_"," ",$pkey).": ".str_replace("\n","<BR />",$pval));

if this is incorrect can you cut and paste the actual line of code and I

will try it again with the correct script.

Sign in to reply to this post

Ray BorduinWebAssist

That is correct. It will replace any line breaks typed into textarea fields with br tags. You probably just have to replace the "\r\n" with "<br>" as well.

Sign in to reply to this post

mikeybabe

do I do that like this

$MailBody = $MailBody . "\r\n"."<br />";

or this

$MailBody = $MailBody . "\r\n<br />";

or this

$MailBody = $MailBody . "<br />";

How is it supposed to look ???

Sign in to reply to this post

Ray BorduinWebAssist

They would all work.

Sign in to reply to this post

mikeybabe

what does the r\n\ thing do anyway

And by the way that worked

it leaves big spaces between the info but

that is far better than it being bunched up on one line


So thank you Ray

I'm very happy

Sign in to reply to this post

Ray BorduinWebAssist

"\r\n" is a line break in windows. Since blank space is ignored by html, it won't add anything when viewing in html emails, but adds a blank line (or sometimes two on Linux servers) in the code.

If you sent a plain text email with no html content, you would have seen the breaks caused by "\r\n".

To have less space, remove one or all of the lines:
$MailBody = $MailBody . "<br>";

They each represent a line and you have four of them between each field. You could probably remove the two at the top and just leave the two at the bottom.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...