Virtuemart warning could not send a message to

No doubt alot of people have had the same issues as I have with this stupid coding issue with the latest version of virtuemart. There is a problem with the ps_order.php file. While this is an intermitent issue it is still one that can cause extensive issues for alot of people.

The issue is that virtuemart cannot track down the user’s email address when sending data. this is handled on line 635. the code has the following:

$result = vmMail( $from, $dbv->f(“vendor_name”), $db->f(“user_email”), $mail_Subject, $mail_Body, ” );

for diagnostic purposes if you change it to the following:

$result = vmMail( $from, $dbv->f(“vendor_name”), “ This email address is being protected from spambots. You need JavaScript enabled to view it. ”, $mail_Subject, $mail_Body, ” );

Then try sending the email it will work. It has taken a while to work out the actual issue but now that I have found it I have got a quick fix for it.

first of all on line 651 after the else { statement add the following:

echo $userid . ” ” . (int)$d["order_id"];

then on line 583 change the statement to the following:

$q=”SELECT first_name,last_name, user_email FROM jos_vm_user_info WHERE user_id = ‘$userid’ AND address_type=’BT’”;

From there it should be fine to test the sending of mail again. What you will probably find is that this has occurred after an upgrade or data migration from an older version of virtuemart to the newer version.

The results for $userid & (int)$d["order_id"] should equal what is in the user data base for the given user and also for the given order id. If it has not got the corresponding data you may have to get the system to send you the download id by modifying the ps_order.php file as mentioned above to send yourself the download info. Just remember after you are done to roll back that change so that other users can get their new download id’s if they need to.