create-prisma-php-app 2.0.0-beta.4 → 2.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -51,7 +51,7 @@ class Mailer
|
|
|
51
51
|
// Validate and sanitize inputs
|
|
52
52
|
$to = Validator::email($to);
|
|
53
53
|
if (!$to) {
|
|
54
|
-
throw new
|
|
54
|
+
throw new Exception('Invalid email address for the main recipient');
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
$subject = Validator::string($subject);
|
|
@@ -83,8 +83,8 @@ class Mailer
|
|
|
83
83
|
|
|
84
84
|
// Send the email
|
|
85
85
|
return $this->mail->send();
|
|
86
|
-
} catch (
|
|
87
|
-
throw new
|
|
86
|
+
} catch (Exception $e) {
|
|
87
|
+
throw new Exception($e->getMessage());
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -107,7 +107,7 @@ class Mailer
|
|
|
107
107
|
if ($recipient) {
|
|
108
108
|
$this->mail->{$method}($recipient);
|
|
109
109
|
} else {
|
|
110
|
-
throw new
|
|
110
|
+
throw new Exception("Invalid email address in $type");
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
} else {
|
|
@@ -115,7 +115,7 @@ class Mailer
|
|
|
115
115
|
if ($recipient) {
|
|
116
116
|
$this->mail->{$method}($recipient);
|
|
117
117
|
} else {
|
|
118
|
-
throw new
|
|
118
|
+
throw new Exception("Invalid email address in $type");
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -138,19 +138,19 @@ class Mailer
|
|
|
138
138
|
$file = $attachment['path'] ?? null;
|
|
139
139
|
$name = $attachment['name'] ?? '';
|
|
140
140
|
if (!$file || !file_exists($file)) {
|
|
141
|
-
throw new
|
|
141
|
+
throw new Exception("Attachment file does not exist: " . ($file ?? 'unknown'));
|
|
142
142
|
}
|
|
143
143
|
$this->mail->addAttachment($file, $name);
|
|
144
144
|
} else {
|
|
145
145
|
if (!file_exists($attachment)) {
|
|
146
|
-
throw new
|
|
146
|
+
throw new Exception("Attachment file does not exist: $attachment");
|
|
147
147
|
}
|
|
148
148
|
$this->mail->addAttachment($attachment);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
} else {
|
|
152
152
|
if (!file_exists($attachments)) {
|
|
153
|
-
throw new
|
|
153
|
+
throw new Exception("Attachment file does not exist: $attachments");
|
|
154
154
|
}
|
|
155
155
|
$this->mail->addAttachment($attachments);
|
|
156
156
|
}
|