Re: Sending Email with Auth
Re: Sending Email with Auth
You should provide the code
Re: Sending Email with Auth
Here's a nice example showing how to set credentials: How do I authenticate to send an email?
Re: Sending Email with Auth
This is the current code, it works fine with wired connections:
vb.net Code:
Dim smtpCliente As New SmtpClient(My.Settings.SmtpServer, My.Settings.SmtpPort)
smtpCliente.Credentials = New Net.NetworkCredential(My.Settings.AD_User, My.Settings.AD_Password) 'Doesnt make any difference
smtpCliente.DeliveryMethod = SmtpDeliveryMethod.Network
smtpCliente.Send(emailToSend)
In the code I set the credentials, but looks like they aren't used, if i remove the code line it sends the email anyway...
@MattP
Can't open the link...
Re: Sending Email with Auth
The link is to http://systemnetmail.com/faq/4.2.aspx.
Try setting smtpCliente.UseDefaultCredentials to False before setting smtpCliente.Credentials. I seem to remember that not doing this messes up sending the "AUTH login" command.
Re: Sending Email with Auth
Doesn't work.
The message it's something like unable to relay 'email'...
Re: Sending Email with Auth
I'm assuming it's some sort of 550 5.7.1 error.
Since you're providing credentials my best guess would be that the smtp service has granted rights to specific subnets that are allowed to relay. Have your administrator check if the wireless segment is granted access.
If it comes down to it I've had situations where I couldn't get relay access for an smtp server and had to use the SpecifiedPickupDirectory delivery method.
Code:
smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory
smtp.PickupDirectoryLocation = "\\server\c$\Inetpub\mailroot\pickup"
Re: Sending Email with Auth
Thanks once again.
No the wireless subnet doesn't have access, it's company policy, so how could i validate the user by the code and send the email?
I already looked to the DeliveryMethod and the PickupDirectory but i don't understand how can it help me.
Re: Sending Email with Auth
Authenticating won't help anything if the subnet you're coming from doesn't have relay access. I had the same situation in the past and had to use the pickup directory.
You need to make sure that the credentials you're providing can access the pickup directory. If you're using the Windows SMTP service it's C:\Inetpub\mailroot\pickup. You just need a share on the server that you have write access to with your credentials.
When you send the email using this delivery method you'll actually be writing a file to that location and then the smtp service has a filewatcher that picks it up. The advantage here is that the server is picking it up locally and thus the address that it's using for the relay is its own.
Re: Sending Email with Auth
Thanks for all the info.
Just another question, how does outlook works? I can send and receive emails normally...
This question it's a little bit out of scope, but i'm curious... :)
Re: Sending Email with Auth
Quote:
Originally Posted by
mickey_pt
Thanks for all the info.
Just another question, how does outlook works? I can send and receive emails normally...
This question it's a little bit out of scope, but i'm curious... :)
I'm not quite sure what you're asking here.
Re: Sending Email with Auth
HEhhe
What I'm asking, how does MSOutlook (email client used in my company), works?
The users are connected to the lan wireless, and they can send emails without any problem, how does Outlook "bypass" the relay question wireless, pickup directory??
I hope this time i made myself clear. :)
Re: Sending Email with Auth
Honestly I'm not sure. It may be that Outlook is using TLS or ImplicitSSL which aren't available in SmtpClient.