Shared
Function SendAdInEmail(ByVal adId
As Integer,
ByVal senderName
As String,
ByVal senderAddress
As String,
ByVal recipientEmail
As String,
ByVal subject
As String,
ByVal message
As String)
As Boolean
Dim sent As
Boolean = False
Dim from
As String =
String.Format("{0} <{1}>", senderName, senderAddress)
Try
Dim m
As New MailMessage(from, recipientEmail)
m.Subject = subject
m.Body = message
Dim client As
New SmtpClient()
client.EnableSsl =
True
client.Send(m)
sent =
True
Catch ex
As Exception
' Consider customizing the message for the EmailNotSentPanel in the ShowAds page.
sent =
False
End Try
Return sent
End Function
please help me
Your mail settings in your web.config maybe incorrect.
You should do a search or contact your host provider, who ever that is, and ask them what smtp settings to use.
And whether it should be ssl enabled or not.
Web:www.Detelli.com Please remember to mark the post as answer that solves your issue.
This will be greatly benificial for other users.
victorantus
Member
50 Points
20 Posts
Re: Email not working with an SMTP server that has SSL?
Jul 16, 2007 08:46 AM|LINK
Hi!
How do I enable Ssl in web.config. I tried enableSsl="true" but it does not work:<
smtp> <network host="smtp.gmail.com" enableSsl="true" password="bla bla" port="587" userName="victorantos@gmail.com" /></
smtp>elbasha
Member
216 Points
635 Posts
Re: Email not working with an SMTP server that has SSL?
Sep 27, 2008 05:23 PM|LINK
I have the same exact question.. I am using Gmail and I need to enable SSL to send emails.
elbasha
Member
216 Points
635 Posts
Re: Email not working with an SMTP server that has SSL?
Sep 27, 2008 05:44 PM|LINK
Found the solution! Enable SSL in your VB code.
mSmtpClient.EnableSsl = True
Note mStmpClient is whatever name you have set for you StmpClient.
araujolima
Member
18 Points
9 Posts
Re: Email not working with an SMTP server that has SSL?
Oct 30, 2008 06:10 PM|LINK
which file should i put this code and which line? mSmtpClient.EnableSsl = True .... to email works
i can't "respond ad" how to fix it?
anyone can help me?
tks
darkknight18...
Contributor
2674 Points
1040 Posts
Re: Email not working with an SMTP server that has SSL?
Oct 31, 2008 02:56 AM|LINK
It's on the App_Code/BLL/Ads.vb page towards the bottom you will see the email that is sent.
It says something like send response
Dim client As New SmtpClient() 'client.EnableSsl = TrueTowards the bottom of this section you will see something like this
client.Send(m)
In order to enable the code above all you have to do is remove the ' at the beginning of the green line.
That's it
Good Luck
Please remember to mark the post as answer that solves your issue.
This will be greatly benificial for other users.
araujolima
Member
18 Points
9 Posts
Re: Email not working with an SMTP server that has SSL?
Oct 31, 2008 11:16 AM|LINK
Hi,
i do not know if i put the code on right place because it doesn't work...respond ADs does not send email.
these are my code:
web.config:<
smtp> <network host="mail.mysite.com" port="25" defaultCredentials="true" userName="myemail@mysite.com" password="mypassword"/></
smtp>And Ads.vb:
Public
Shared Function SendAdInEmail(ByVal adId As Integer, ByVal senderName As String, ByVal senderAddress As String, ByVal recipientEmail As String, ByVal subject As String, ByVal message As String) As Boolean Dim sent As Boolean = False Dim from As String = String.Format("{0} <{1}>", senderName, senderAddress) Try Dim m As New MailMessage(from, recipientEmail)m.Subject = subject
m.Body = message
Dim client As New SmtpClient()client.EnableSsl =
Trueclient.Send(m)
sent =
True Catch ex As Exception ' Consider customizing the message for the EmailNotSentPanel in the ShowAds page.sent =
False End Try Return sent End Function please help methanks
darkknight18...
Contributor
2674 Points
1040 Posts
Re: Email not working with an SMTP server that has SSL?
Oct 31, 2008 01:44 PM|LINK
Your mail settings in your web.config maybe incorrect.
You should do a search or contact your host provider, who ever that is, and ask them what smtp settings to use.
And whether it should be ssl enabled or not.
Please remember to mark the post as answer that solves your issue.
This will be greatly benificial for other users.