Jump to content

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.

Link to comment
https://forums.phpfreaks.com/topic/3559-double-quotes-within-mail-body/
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]
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
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.
[!--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
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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