Error sending notifications Options
dawoe
Posted: Saturday, April 19, 2008 4:18:00 PM

Rank: Aficionado

Joined: 1/19/2008
Posts: 170
Location: Belgium
Hi,

I just moved my site my hosting account. I'm getting the following error when sending notifications :

Code:

Error in notification: System.Net.Mail.SmtpException: Command parameter not implemented. The server response was: : Helo command rejected: need fully-qualified hostname at System.Net.Mail.RecipientCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at umbraco.cms.businesslogic.workflow.Notification.sendNotification(User performingUser, User mailingUser, Document documentObject, IAction Action) at umbraco.cms.businesslogic.workflow.Notification.GetNotifications(CMSNode Node, User user, IAction Action)


I think it's caused because I need to set user name and password for the smtp server. Where do I set it ?

Converting a DotNetNuke site to Umbraco : Follow it here
marc.stoecker
Posted: Saturday, April 19, 2008 4:31:07 PM

Rank: Enthusiast

Joined: 1/12/2007
Posts: 31
Location: Germany
This is more of a general SMTP error message. Your machine does to connect w/o a FQDN to the SMTP. I think (just an idea) that without providing SMTP username and password, the receiving SMTP does think you do want to deliver via SMTP in w/o auth and relay (like a mailserver trying to drop of mails for this server's recipients).

Like you said, I would try to set the username and pwd in web.config (the way it works with any ASP.NET 2.0 site).:

Code:
<configuration>
  <!-- Add the email settings to the <system.net> element -->
  <system.net>
    <mailSettings>
      <smtp>
        <network
             host="relayServerHostname"
             port="portNumber"
             userName="username"
             password="password" />
      </smtp>
    </mailSettings>
  </system.net>

  <system.web>
    ...
  </system.web>
</configuration>


Hope this helps,
Marc

mindrevolution - applied communication science
drobar
Posted: Saturday, April 19, 2008 4:34:23 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
This line might suggest that you haven't set the smtp server name properly: "Helo command rejected: need fully-qualified hostname"

Check the <add key="umbracoSmtpServer" ... /> setting in your web.config.

Usually (not always), if you are sending email from an account in your domain to an account in your domain you won't need to specify the username/password of the server because there is no relaying being attempted. For instance, sending from info@example.com to me@example.com will often work.

If you do need to provide a username and password, check out Casey's note in this post: http://www.codeplex.com/umbraco/WorkItem/View.aspx?WorkItemId=6159

(further reading at http://forum.umbraco.org/yaf_postst2481_How-do-I-supply-credentials-for-the-SMTPserver.aspx)

cheers,
doug.


MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
marc.stoecker
Posted: Saturday, April 19, 2008 5:04:33 PM

Rank: Enthusiast

Joined: 1/12/2007
Posts: 31
Location: Germany
drobar wrote:
This line might suggest that you haven't set the smtp server name properly: "Helo command rejected: need fully-qualified hostname"

Sorry, but setting a umbraco config value wouldn't change your FQDN of the machine (which was rejected by - say postfix, etc.).

drobar wrote:

Check the <add key="umbracoSmtpServer" ... /> setting in your web.config.

Are we still using this with umbraco v3? Just curious, we use dedicated mail routines that utilize the standard web.config-way. I thought umbraco does this also now that it's running on ASP.NET 2?
Sorry for suggesting the web.config-way with out checking first! :-)

drobar wrote:

Usually (not always), if you are sending email from an account in your domain to an account in your domain you won't need to specify the username/password of the server because there is no relaying being attempted. For instance, sending from info@example.com to me@example.com will often work.

Well, provided that we have whitelistes SMTPs, inner domain-setups or self-authorizing relay-/gateway-servers. A local relay (MS-SMTP on localhost with forward/relay setup) would also allow this in most cases (as it's configured to that machine or website). generall you're right when we're assuming "inner network" situation. Best would be to ask the ISP, they normally provide this info with the config panel or some support site or knowledge base...

Sorry again for the confusion about the SMTP settings. I thought this was natural to move with the v3 but didn't check... shame on me... ;-)

so long,
Marc

mindrevolution - applied communication science
drobar
Posted: Saturday, April 19, 2008 5:20:47 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
Hey, Marc,

You know, I just assumed that since the supplied web.config includes the umbracoSmtpServer it was the preferred method. I know it works because I use it. But perhaps that setting is just an umbraco short-hand for the <MailSettings> maintained for backward compatibility with older packages that look for that setting.

I guess we need to crack open the source and look to answer Dave's question completely and accurately. Shame on us both :o)

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
drobar
Posted: Saturday, April 19, 2008 5:44:48 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
Looking at the source (for v3.0.5), there are lots of lines like this:
Code:
System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(GlobalSettings.SmtpServer);


The GlobalSettings.SmtpServer is:
Code:
        /// <summary>
        /// Gets the SMTP server IP-address or hostname.
        /// </summary>
        /// <value>The SMTP server.</value>
        public static string SmtpServer
        {
            get
            {
                try
                {
                    return ConfigurationManager.AppSettings["umbracoSmtpServer"];
                }
                catch
                {
                    return "";
                }
            }
        }


So the umbracoSmtpServer setting is definitely used and not only for backward compatibility. But since the System.Net.Mail.SmtpClient object is being used, the "web.config" way Marc mentioned is also viable.

Given this code, can someone explain what will happen in the following scenarios so we can get to a definitive answer about how email servers can be configured for use with umbraco?

SCENARIOS
1. With umbracoSmtpServer specified AND the mailSettings also specified, what settings will ultimately be used when connecting to the email server? Only the hostname in umbracoSmtpServer? Only the information in mailSettings (which can include username and password)?

2. If umbracoSmtpServer is empty AND the mailSettings are specified, what settings will be used when connection to the email server?

3. If umbracoSmtpServer specifies one server (e.g., 127.0.0.1) and mailSettings specifies a different server (e.g., mail2.example.com), what server will send the email?


Thanks for your help in understanding exactly what is going on and how best to configure umbraco.

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
neehouse
Posted: Saturday, April 19, 2008 9:08:39 PM

Rank: Umbracoholic

Joined: 7/20/2006
Posts: 1,074
Location: Charleston, West Virginia, United States
As far as I am aware, the method in which umbraco uses the smtp server does not allow for the mailsettings. If you remove the references to the smtp server setting from the instantiation, it should start using the mailSettings.

If a work item has not been submitted on this at codeplex, please do so. We should make this work with both the umbraco setting (if no mailsettings) and the mailSettings in some manner.



• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
drobar
Posted: Saturday, April 19, 2008 9:36:29 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
Codeplex entry at http://www.codeplex.com/umbraco/WorkItem/View.aspx?WorkItemId=16197

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
dawoe
Posted: Sunday, April 20, 2008 12:53:47 PM

Rank: Aficionado

Joined: 1/19/2008
Posts: 170
Location: Belgium
I added the settings and notifications started working. Thanks guys !!

But now i have another problem. The mails I receive have the subject [mailSubject] and the body [mailBodyHtml]

Do i have to set something first

Converting a DotNetNuke site to Umbraco : Follow it here
mortenbock
Posted: Sunday, April 20, 2008 1:01:13 PM

Rank: Addict

Joined: 7/19/2006
Posts: 791
Location: Århus, Denmark
dawoe wrote:

But now i have another problem. The mails I receive have the subject [mailSubject] and the body [mailBodyHtml]

Do i have to set something first


What language do you use in your Umbraco Administration?

It looks like the labels for notifications have not been defined in your language.

take a look in the umbraco\config\lang directory where you will find the language XML files. Here you can translate the mail messages from the en.xml file and save them in your own language.

Look for the

<area alias="notifications" ...

near the end of the file.

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

dawoe
Posted: Sunday, April 20, 2008 1:03:21 PM

Rank: Aficionado

Joined: 1/19/2008
Posts: 170
Location: Belgium
mortenbock wrote:
dawoe wrote:

But now i have another problem. The mails I receive have the subject [mailSubject] and the body [mailBodyHtml]

Do i have to set something first


What language do you use in your Umbraco Administration?

It looks like the labels for notifications have not been defined in your language.

take a look in the umbraco\config\lang directory where you will find the language XML files. Here you can translate the mail messages from the en.xml file and save them in your own language.

Look for the

<area alias="notifications" ...

near the end of the file.


Hi Morten,

Thx for the reply. But I found it already. I'm using the Dutch language and this was missing some keys in the file. I downloaded one from a changeset in codeplex. In v3.0.5 these keys are still missing.

Converting a DotNetNuke site to Umbraco : Follow it here
marc.stoecker
Posted: Sunday, April 20, 2008 4:13:34 PM

Rank: Enthusiast

Joined: 1/12/2007
Posts: 31
Location: Germany


While I did enjoy my weekend, you did all the work digging the source and filing the issue.
Thanks for taking the time, doug. No, really!

//M


mindrevolution - applied communication science
warren
Posted: Thursday, June 26, 2008 6:20:17 PM

Rank: Addict

Joined: 7/19/2006
Posts: 777
Location: Leigh-on-Sea, Essex, UK
Hello all,
After reading this im still slightly confused.

Can someone please advise me on the CORRECT method to use for configuring umbraco with Mail server settings?

On a side note: The method I choose I will need to tap into fro the default ASP.NET membercontrol which V4 supports with MembershipProvider to send emails for forgotton passwords and new users.

Thanks,
Warren



Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
psterling@homax
Posted: Thursday, June 26, 2008 7:41:43 PM

Rank: Fanatic

Joined: 10/30/2007
Posts: 215
Location: Bellingham
Warren -

The convention is to set this in web.config as follows:

<system.net>
<mailSettings>
<smtp from="sales@yourdomain.com">
<network host="mail.yourdomain.com" password="yourpassword" userName="youruser"/>
</smtp>
</mailSettings>
</system.net>

I believe this is the gist of the CodePlex work item mentioned above. I know I don't need to say it, but what the heck:

"Convention over configuration"

We should deprecate the AppSetting umbracoSmtpServer with v4.0

-Paul

motusconnect.com :: level-2 certified :: MVP 2008/2009
kalpa
Posted: Thursday, June 26, 2008 7:47:04 PM

Rank: Fanatic

Joined: 7/19/2006
Posts: 492
Location: Göteborg, Sweden
I would go for the system.net way that Douglas wrote in the Codeplex issue above. I'm using this way at a host that doesn't allow mail sending via localhost and it works great with both the massmailer and the notifications. It seems to me that the system.net way overrides the appsettings key...

// ;) Kalle

" - Yeah I'd like to share your point of view, as long as it's my view too... (http://www.d-a-d.dk/lyrics/pointofview)
warren
Posted: Thursday, June 26, 2008 8:00:07 PM

Rank: Addict

Joined: 7/19/2006
Posts: 777
Location: Leigh-on-Sea, Essex, UK
OK excellent thanks Kalle & Paul I appreciate it. I will use this method. I agree with convention, why reinvent the wheel?

Warren



Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
warren
Posted: Monday, June 30, 2008 6:43:24 PM

Rank: Addict

Joined: 7/19/2006
Posts: 777
Location: Leigh-on-Sea, Essex, UK
Slightly off-topic but one of you guru's may be able to help me.

Im using this new <system.net> web.config method with gMail as my SMTP which requires SSL enabled to work.
Is it possible to enable this from the web.config at all or is it only code-behind?

As I am trying to get the asp:RecoverPassword control in v4 to work ;)

Warren




Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
kalpa
Posted: Monday, June 30, 2008 8:11:56 PM

Rank: Fanatic

Joined: 7/19/2006
Posts: 492
Location: Göteborg, Sweden
Hi Warren!

It seems that that just won't work...

I found this thread at forum.asp.net where one replier suggests that you must set a parameter SmtpClient.EnableSsl = True. A wild guess is that this setting isn't implemented in Umbraco notifications at all...

But the first try would be to add a port="" attribute to the network element:
Code:
<system.net>
    <mailSettings>
      <smtp deliveryMethod="network" from="xyz@gmail.com">
        <network host="smtp.gmail.com" port="25" userName="uid" password="pwd"/>
      </smtp>
    </mailSettings>
  </system.net>


// ; ) Kalle


" - Yeah I'd like to share your point of view, as long as it's my view too... (http://www.d-a-d.dk/lyrics/pointofview)
warren
Posted: Monday, June 30, 2008 8:15:32 PM

Rank: Addict

Joined: 7/19/2006
Posts: 777
Location: Leigh-on-Sea, Essex, UK
Hiya Kalle, I have tried the recommend port google SSL port, but this still does not work.

I would prefer not to do any code behind stuff if necessary.

//Warren



Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
psterling@homax
Posted: Monday, June 30, 2008 8:23:41 PM

Rank: Fanatic

Joined: 10/30/2007
Posts: 215
Location: Bellingham
Warren -

The way I've seen this done is generally via a virtual SMTP server on the same box (or same network at least) that acts as a relay to the GMail server. This allows you to configure SSL for the connection to GMail but have the local mail server set as non-SSL (you can also use default credentials and thereby not have to deal with plain-text credentials). Additionally, using the a local mail server affords you asynchronous email transfer that will buffer your app against GMail delays or downtime. And, finally, you need not touch the code behind.

Hope this helps.
-Paul

motusconnect.com :: level-2 certified :: MVP 2008/2009
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.