At a complete guess your subject variable is empty and therefore your email is not getting send / or getting sent to you junk mail.
If you check your Umbraco Log table you'll see that 'umbraco.library:SendMail' reports an error if it fails, no errors means the problem is recieving the email or physically via your smtp server, ie not an Umbraco issue.
Maybe it's adding a carriage return in the subject since you have it on two lines? Try condensing it all in one line or possibly wrap it in a normalize-space():
But if that was the case I would think you'd get an error in umbracoLog....hmm. Does your $subject variable work fine if you use it as the email body instead of the subject?
Even though they were both the same variable, the Subject can't have carriage returns in it. Because of the way you constructed your variable the subject would actually be:
Name Company Some subject text
Which of course you can't use as a subject. I imagine you would have an error in your umbracoLog about this.
normalize-space() will collapse the whitespace so it outputs on one line.
Parameter problem with umbraco.library:SendMail()
Hi.
I'm using SendMail and I've setup the smtp server in the web.config and everything is working fine:
Then I want to make variables for subject and text:
When I only use the $text variable it works fine, and I still receive the email:
But if I use both $text and $subject, or $subject only, it doesn't work?
Can it be a problem with creation of the variables, or maybe something to do with sendmail?
Hi,
At a complete guess your subject variable is empty and therefore your email is not getting send / or getting sent to you junk mail.
If you check your Umbraco Log table you'll see that 'umbraco.library:SendMail' reports an error if it fails, no errors means the problem is recieving the email or physically via your smtp server, ie not an Umbraco issue.
Rich
Hi, I've tested that my $subject variable isn't empty, and also checked my junk mail.
There's also no entries in the Umbraco log table.
Maybe it's adding a carriage return in the subject since you have it on two lines? Try condensing it all in one line or possibly wrap it in a normalize-space():
But if that was the case I would think you'd get an error in umbracoLog....hmm. Does your $subject variable work fine if you use it as the email body instead of the subject?
-Tom
Hi Tom, it didn't help to use $text as subject parameter.
But normalize-space(): did the trick! thanks!
But still a bit odd that 1 parameter worked fine, but not both, even if they're the same value?
Hi,
Glad it worked.
Even though they were both the same variable, the Subject can't have carriage returns in it. Because of the way you constructed your variable the subject would actually be:
Name
Company
Some subject text
Which of course you can't use as a subject. I imagine you would have an error in your umbracoLog about this.
normalize-space() will collapse the whitespace so it outputs on one line.
-Tom
Cheers, I see it clearly now, and yes I also found the error in the umbracoLog :-)
Thanks!
is working on a reply...