Jump to content

Archived

This topic is now archived and is closed to further replies.

pakenney38

Double Quotes within $mail->Body ="";

Recommended Posts

In PHPMailer's syntax there is this thing:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$mail->Body = "";[/quote]

Is there any way to put PHP code and double quotes inside this statement to send out a dynamic-type HTML e-mail message? I've tried escaping double-quotes and all that, but it never seems to work.

Share this post


Link to post
Share on other sites
Not sure where your getting the $mail->Body from...unless you are using a self/3rd party created class to create and send emails...which could be your problem.

the mail function allows you to include all the quotes and variables you want...just escape the quotes, and remember the difference between double and single quotes with regard to variable substitution.

[code]$body = "this is a quote: \"some text\" \n\nfollowed by a var: $var";
mail('you@mail.com', 'An email for you',$body);[/code]

[a href=\"http://us2.php.net/manual/en/function.mail.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.mail.php[/a]

Share this post


Link to post
Share on other sites
I thought the PHPMailer class was fairly common. Guess I was wrong. Well, I will try to get mail setup up in my php config to use our SMTP server then.

Share this post


Link to post
Share on other sites
It depends. Some people roll their own and some done ... and some don't send email that needs PHPmailer.

There is a email list devoted to phpmail. You can sign up at [a href=\"http://lists.sourceforge.net/lists/listinfo/phpmailer-general\" target=\"_blank\"]http://lists.sourceforge.net/lists/listinf...pmailer-general[/a]

Ken

In answer to your original question.... If you manage to put PHP code into an email message, where is the server that is going to process that code? There is no way that PHP code will execute in the confines of an email message. It might be better to create a special web site and email the URL.

Also, since you never showed us what you attempted, there was no way that anyone could even try to help.

If you need help, post the code that is giving you problems and what you attempted.

Ken

Share this post


Link to post
Share on other sites
I will pull the code together and post it tomorrow from work.
In a nutshell, say I have some PHP code. I want to process that PHP code into HTML first, and then send the HTML through an e-mail message. Right now I can't make that happen with PHPmailer without getting a parse error, even if I escape all of the double-quotes and stuff. I may just be missing something.

By the way, as a separate argument, mailing lists are a nuisance. Basically you are force-fed all of this mail that you may not be able to help with, but you get it in your Inbox anyway. At least with a message board, you can pick and choose what you want to reply to, without having to sort or delete anything. Mailing lists are archaic.

Share this post


Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]By the way, as a separate argument, mailing lists are a nuisance. Basically you are force-fed all of this mail that you may not be able to help with, but you get it in your Inbox anyway. At least with a message board, you can pick and choose what you want to reply to, without having to sort or delete anything. Mailing lists are archaic.[/quote]

But if there is a mailing list available to you that can help with your problem, then you use that tool.

I am subscribed to many mailing lists, they all are filtered into their own mailboxes. I don't read most of the messages when then come in, but if I have a problem, I will search the saved messages for a solution. I can scan the subject lines in saved messages just as well as I can scan them in a forum. Plus I can read and search the mailboxes even when I'm offline.

I think mailing lists still have their place in the online world, just USEnet newsgroups have a place. The predate many mailing lists.

Ken

Share this post


Link to post
Share on other sites
nevermind. I rewrote the code to use mail() instead of PHPmailer. Since I already knew this method, it worked. The only issue I have with it is that our SMTP server requires that the outgoing email address be described very specifically, and I'm having a hard time masking this address. But that's another thread.

Share this post


Link to post
Share on other sites

×

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.