$headers = "From: " . $email . "\r\n"; // this would need to be changed to an address tied to the domain noreply@host.com
$headers .= "Reply-To: " . $email . "\r\n"; // this can be as is, the senders address.
ChatGPT explains far better than I ever could. There are a lot more details but the crux of it is some hosts have this security in place some don’t.
3. SMTP Configuration
If you’re using SMTP to send emails (which is likely the case in a production environment), the SMTP server may require that the sender’s email address matches the domain used in the SMTP credentials (username and password). If the sender email doesn’t match, the SMTP server may reject the request, resulting in the form submission failure.
its not rejecting it…and I have a form in foundry works perfectly
as in whatever email I put in the FROM field is exactly what shows in the email…not my own. if someone uses the form they should be putting their email in not mine.if I hit reply it would come straight back to me!!!
Un-tested, but may work, as it would be nice to have the from header as well as the reply-to header be the senders address where possible (server pending).
<?php
$fromEmail = $email; // The email entered by the form filler
$hostDomain = "yourdomain.com"; // The domain associated with your server
// Extract the domain from the email address
$emailDomain = substr(strrchr($fromEmail, "@"), 1);
// Check SPF record for the domain
if (checkdnsrr($emailDomain, 'TXT')) {
// If SPF record exists for the domain, proceed with sending the email
$headers = "From: " . $fromEmail . "\r\n";
} else {
// If no SPF record exists or domain is unauthorized, use your own "From" address
$headers = "From: noreply@yourdomain.com\r\n";
}
?>
That’s never going to work
Safer just to guarantee the norepy@
<?php
$headers = "From: noreply@yourdomain.com\r\n"; // Always use a trusted address
$headers .= "Reply-To: " . $email . "\r\n"; // Allow the form filler’s email as the Reply-To address
?>
Just checked the code—and it turns out the From address is being set to the email field from the form. That explains why it fails when using anything other than an email address from the same domain!
So, was the form component fixed in the last beta (maybe 2 days ago?)…or is it still a work in progress?
I’ve been banging my head on the wall trying to get this thing to work (in the “Fitness” project sample, published to a sandbox site on my host.
I’ve tried multiple variations of configurations to no avail! I’ve also used “mail”, “smtp”, etc. in front of the host address too.
Yes, I’m trying to send to a different e-mail (which I read was now possible), but I have also tried using the email directly associated with the form and host. It still gave me my “Oops! Something went wrong!” message.
I’ve updated my PHP version to 8.4. The recommended API test does not work (I don’t see any message when I append “?apicheck” to the page.
Here’s what I’ve been working with (see screenshots of the settings section and my host’s config details - yes, password was filled in my form settings, just left it blank for the screenshot for this post).
The fact that this is not working might suggest that the form (and the required files) have not been published correctly. Can you try “re-publishing all files” and see if that resolves the issue.
@dan , I’ve re-published all files numerous times…even gone in manually and cleared out everything in CPanel, the re-published again…no joy This apicheck still does not display.
I’ll admit, I’m no coder or web expert, but I’ve managed to get this stuff working on numerous occasions with earlier versions of RW. This has me stumped.
I may also reach out to my host today and see if there’s anything going on server-side.
EDIT: Working with my web host right to to check for any issues.
I’ve also tested to ensure outgoing messages can send from the address I’m using in the form.
I copied my form and pasted JUST the form into a new blank project - it then published almost 800 files!. And on the first try in the empty project, boom! It worked.
Now, the only thing that’s still a bit wonky is that the email I got from the form looks like this:
yeah I had this in one of my forms
Radio-rw3FACF85D 87AD 4ACF B70D 4745E175D6FE: Yes
Dan solved it by telling me to give the form item a name.
and it worked fine
in the settings
Just an FYI to anyone reading this: we had to give each field a unique name by default, this is why you’ll see something like input-{UNIQUE-STRING-ID} when you have manually entered a name for the field.
Just enter a name for the form input in Elements and everything will update automatically
I am struggling with the Form component in Elements also.
Gave the various parts a name. The Form itself. Put in “all” fields. Reset is strange though. No matter if I have that on or off, it not showing in the published page.
Tried on my server, tried with ServBay (nice, thanks for the tip!).
Verification of required fields runs (fine) when clicking on “Submit”, but that seems to be it.
Any ideas? Pointers? as what to look at next …?
Hey Ben,
thanks for speedy response! Much appreciated
Yes, I can put it “out there” . Please do check out this URL if you have the time.
I guess what I am struggling with is this message (from Safari Console log):
Failed to load resource: the server responded with a status of 404 ()
https://www.vps13.org/rw/elements/com.realmac.apipack/api/email
Please note that I tried deleting all files manually, Re-Plublishing “All” and noticed that File➜ “Publish Current Page …” still publishes 685 files after a Publish All.
Lot’s of them .php files …
The message above comes after doing this.
Looking forward to your, as always, educating feedback.