SMTP

Jan 19, 2009 at 7:18 AM
Hi

How can I get the smtp server address from the root?
Is there a function for that?

Coordinator
Jan 19, 2009 at 5:12 PM
You can look at how the mail sender service does it.
Jan 19, 2009 at 5:55 PM
Thanks

But I can't get it to work

Object reference not set to an instance of an object

It's done in vb. What I'm I doing wrong?

Dim

persister As IPersister
Dim host As IHost

 

 

Dim root As ContentItem = persister.Get(host.CurrentSite.RootItemID)
Dim smtpHost As String = TryCast(root("SmtpHost"), String)

 

Coordinator
Jan 19, 2009 at 6:06 PM
Looks like you're not assigning persister and host to anything useful.

Try this:

        Dim persister = N2.Context.Current.Resolve(Of N2.Persistence.IPersister)()
        Dim host = N2.Context.Current.Resolve(Of N2.Web.IHost)()

Jan 19, 2009 at 7:40 PM
Thansk

That helped. Now it works.
Aug 13, 2009 at 6:41 PM
Edited Aug 13, 2009 at 6:45 PM

How do I store the smtp information?

I was thinking...

<appSettings>
    <add key="SMTP.Server" value="serveraddress"/>
    <add key="SMTP.UN" value="username"/>
    <add key="SMTP.PW" value="password"/>
    </appSettings>

But from the above tread it seems that the values are data driven and should be in database table N2Item root?

Using the SQLite database browser I can see record 1 name = root and title = [root]

I know this sounds a dumb question but...

Can you give an example of how to do this please?

Aug 13, 2009 at 7:10 PM
Edited Aug 13, 2009 at 7:10 PM

oops sorry guys :)

I can see now that it is built into the system; all I need to do is use edit the dialogue.

Edit "[root]"

 

Well I have said I am new to this!

Sep 16, 2009 at 11:59 AM
libardo wrote:
Looks like you're not assigning persister and host to anything useful.

Try this:

        Dim persister = N2.Context.Current.Resolve(Of N2.Persistence.IPersister)()
        Dim host = N2.Context.Current.Resolve(Of N2.Web.IHost)()

 

Could you supply a C# version of the lines above?  Thanks!

Sep 16, 2009 at 2:46 PM
That looks like your standard generic method call syntax, so:

var persister = N2.Context.Current.Resolve<N2.Persistence.IPersister>()
var host = N2.Context.Current.Resolve<N2.Web.IHost>()



2009/9/16 bressljr <notifications@codeplex.com>

From: bressljr

libardo wrote:
Looks like you're not assigning persister and host to anything useful.

Try this:

        Dim persister = N2.Context.Current.Resolve(Of N2.Persistence.IPersister)()
        Dim host = N2.Context.Current.Resolve(Of N2.Web.IHost)()

 

Could you supply a C# version of the lines above?  Thanks!

Read the full discussion online.

To add a post to this discussion, reply to this email (n2cms@discussions.codeplex.com)

To start a new discussion for this project, email n2cms@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Sep 19, 2009 at 11:20 PM
Edited Sep 19, 2009 at 11:22 PM

I have just installed the version - WebForms Templates Starter Kit (with C#/VB.NET integration project) which works great. However, I am unable to send mail even after entering all the correct settings in the smtp section. I am getting the following:

Mailbox name not allowed. The server response was: <cristian@libardo.com>: Sender address rejected: not owned by user. . .

and also:

System.Net.Mail.SmtpException: Transaction failed. The server response was: <cristian@libardo.com>: Recipient address rejected: Relay access denied

Any help would be appreciated.

** My webhost is fasthosts.co.uk which operate just below full trust level

Sep 20, 2009 at 8:45 AM

cristian@libardo.com is the creator of the N2 system's mail server, that you do not have access to :)

You have to use your own mail server name or address!

Sep 20, 2009 at 11:03 AM
Edited Sep 20, 2009 at 11:15 AM

Thanks for the response. I made some changes and played arround with it for a bit - issue is now resolved!