Jump to content


Photo

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


  • Please log in to reply
7 replies to this topic

#1 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 23 February 2006 - 10:48 PM

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.



#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 23 February 2006 - 11:33 PM

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.

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

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

#3 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 25 February 2006 - 05:47 AM

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.

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 25 February 2006 - 06:24 AM

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


#5 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 27 February 2006 - 03:12 AM

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.

#6 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 February 2006 - 04:00 AM

[!--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

#7 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 28 February 2006 - 04:22 PM

code soon to be posted...

#8 pakenney38

pakenney38
  • Members
  • PipPipPip
  • Advanced Member
  • 90 posts

Posted 01 March 2006 - 03:05 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users