This topic is locked
[SOLVED]

Send email with Two different Image Values

8/20/2025 5:19:40 PM
PHPRunner General questions
Tandy author

I have it set up with one image field value with this code:

$fileArray = my_json_decode($values["other_images"]);

$attachments = array();
foreach($fileArray as $f)
{
$attachments[] = array("path" => $f["name"]);
}

But now I have another image field value to add to it: $value["weight_image"]
Does any one know how to have it send the two image values in the same email?

Here is my full working code. But like I said I need to add another field called weight_image of a course 1 image file. The other_images is 4 images.:

$email="dispatch@ANOTHERDOMAIN.com";
$from="noreply@MYDOMAIN.com";
$subject="Trip Load: ".$values["trip_number"]."\r\n";

$fileArray = my_json_decode($values["other_images"]);

$attachments = array();
foreach($fileArray as $f)
{
$attachments[] = array("path" => $f["name"]);
}

$msg="Here is the load dimensions and information\r\n";
$msg.= "Width: ".$values["loaded_width"]." ".$values["loaded_width_in"]."\r\n";
$msg.= "Height: ".$values["loaded_height"]." ".$values["loaded_height_in"]."\r\n";
$msg.= "Front Overhang: ".$values["front_overhang"]." ".$values["front_overhang_in"]."\r\n";
$msg.= "Rear Overhang: ".$values["rear_overhang"]." ".$values["rear_overhang_in"]."\r\n";
$msg.= "Length: ".$values["loaded_length"]." ".$values["loaded_length_in"]."\r\n";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=> $from, 'attachments' => $attachments));
if(!$ret["mailed"])
echo $ret["message"];
Tandy author 8/20/2025

when I have the code this way:

$email="dispatch@ANOTHERDOMAIN.com";
$from="noreply@MYDOMAIN.com";
$from="noreply@tandyservices.com";
$subject="Edited - Trip Load: ".$values["trip_number"]."\r\n";

$fileArray = my_json_decode($values["other_images"]);
$fileArray = my_json_decode($values["weight_image"]);

$attachments = array();
foreach($fileArray as $f)
{
$attachments[] = array("path" => $f["name"]);
}

$msg="Here is the load dimensions and information for ".$values["trip_number"]."\r\n";
$msg.= "This is just a message that this load was EDITED for some reason and has been updated."."\r\n";
$msg.= "Width: ".$values["loaded_width"]." ".$values["loaded_width_in"]."\r\n";
$msg.= "Height: ".$values["loaded_height"]." ".$values["loaded_height_in"]."\r\n";
$msg.= "Front Overhang: ".$values["front_overhang"]." ".$values["front_overhang_in"]."\r\n";
$msg.= "Rear Overhang: ".$values["rear_overhang"]." ".$values["rear_overhang_in"]."\r\n";
$msg.= "Length: ".$values["loaded_length"]." ".$values["loaded_length_in"]."\r\n";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=> $from, 'attachments' => $attachments));
if(!$ret["mailed"])
echo $ret["message"];

It only sends me the $values["weight_image"] Image not the other 4 images

Tandy author 8/21/2025

Okay, Here is the code that sends me all 5 images in the email..

$email="dispatch@ANOTHERDOMAIN.com";
$from="noreply@MYDOMAIN.com";
$from="noreply@tandyservices.com";
$subject="Edited - Trip Load: ".$values["trip_number"]."\r\n";

$other_images_array = my_json_decode($values['other_images'], true);
$weight_image_array = my_json_decode($values['weight_image'], true);

$fileArray = array_merge($other_images_array, $weight_image_array);

$attachments = array();
foreach($fileArray as $f)
{
$attachments[] = array("path" => $f["name"]);
}

$msg="Here is the load dimensions and information for ".$values["trip_number"]."\r\n";
$msg.= "This is just a message that this load was EDITED for some reason and has been updated."."\r\n";
$msg.= "Width: ".$values["loaded_width"]." ".$values["loaded_width_in"]."\r\n";
$msg.= "Height: ".$values["loaded_height"]." ".$values["loaded_height_in"]."\r\n";
$msg.= "Front Overhang: ".$values["front_overhang"]." ".$values["front_overhang_in"]."\r\n";
$msg.= "Rear Overhang: ".$values["rear_overhang"]." ".$values["rear_overhang_in"]."\r\n";
$msg.= "Length: ".$values["loaded_length"]." ".$values["loaded_length_in"]."\r\n";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=> $from, 'attachments' => $attachments));
if(!$ret["mailed"])
echo $ret["message"];

Hope that is the right way of doing it.. I mean it works with no errors. So I will mark this as solved..

img alt