0

I have a website that allows user to submit a query by selecting few dropdown values and then the result needs to be sent to the email address that the user provides. I want to send a path to the file as a text in the email. However, it is not working. I just get an email with no body and some ATTT00001.bin attachment. I could send the results to user as an attachment but don't want to flood their emails with big attachments. So, we decided to just provide a link to the file. Here is the code that is not working.

 exec(' printf "Please find attached the query result for following 
 selection:\n\nApp: '.$varApp.'  \nConfig: '.$varConfig.' \nCounter Type: 
 '.$varCtrType.'  \n\n Path to 
  result:\"http:abc.def.com\\"'.$output[8].' \n\n Thanks!\n 
  Disclaimer:Auto generated mail. Do not reply." | /bin/mail -s "Database 
  Query Result" '.$varEmail.'  2>&1', $output2 );

The path that I want to display is "http://abc.def.com/'.$output[8].'" where output[8] is a variable that holds the name of the result file.

I appreciate your help. Also, I know a lot of people will have issue with not using phpmailer or inbuilt mail, but I have my reasons for not using it right now.

Thanks!

Aisha
  • 91
  • 7
  • Not sure why you're using `exec()`, but your quotation marks don't line up. Your starting quotation mark `"` of `printf "Here` ends just before the `T` in `Testing`. In addition to this, your `exec()` quotation mark will attempt to execute `$output[8]`. Regardless of what you're trying to do there, you have several syntax errors that will be thrown by your quotation mark ordering. You may be looking to escape some of them with a backslash. – Obsidian Age Nov 13 '18 at 19:41
  • Possible duplicate of [PHP parse/syntax errors; and how to solve them?](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) –  Nov 13 '18 at 20:17
  • I have done a copy paste of the exec command now and the typos in previous version are not present anymore. – Aisha Nov 13 '18 at 21:01

2 Answers2

0

There is a php-command "mail". But better to use something like swiftmailer to send mails with php.

Eugen Spinne
  • 83
  • 1
  • 4
0

Thanks all for your time. However, I managed to solve it by myself by using "/" for /.

Aisha
  • 91
  • 7