简体   繁体   中英

sending link as text using mail in php

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!

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM