Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Sending E-mail using custom coding!!!Sending E-mail using custom coding!!!
Previous
 
Next
New Post
1/2/2008 9:28 AM
 

Hi guys. i am sahil sindhi new to DNN. i work on DNN from. few months.

i got the induilt method of DNN lib  - DotNetNuke.Services.Mail.Mail.SendMail. ican also send mail and  getting to but i can't change "FROM" name. E-mail shows SMTP username. so what can i do?

pls answer.

Sahil.

 
New Post
1/2/2008 12:12 PM
 

I didn't like the core's implementation of email functions (i wanted to be able to send automatic cc's to an admin for all outgoing mails)... so i extended it with my own; here it is:

Imports

DotNetNuke.Services.Mail

Imports

DotNetNuke.Common.Globals

Namespace

 

 

 

 

 

EmailPublic Class HelperPublic Shared Sub SendUserRDMail(ByVal ToAddress As String, ByVal MailPriority As MailPriority, ByVal Subject As String, ByVal Body As String, ByVal BodyFormat As MailFormat, ByVal PortalId As String)Dim FromAddress As String = RealDropzone.RDSettings.GetSetting(RealDropzone.RDSettings.Settings.Email_FromAddress, PortalId)Dim SentMailLogAddress As String = RealDropzone.RDSettings.GetSetting(RealDropzone.RDSettings.Settings.Email_SentMailLogAddress, PortalId)Dim HTMLBREAK As String = ""

 

If BodyFormat = MailFormat.Html Then HTMLBREAK = "<br/>"

 

Dim SMTPServer As String = ""

 

Dim SMTPAuthentication As String = ""

 

Dim SMTPUsername As String = ""

 

Dim SMTPPassword As String = ""

 

Subject = DropzoneName &

 

 

 

 

 

strLogBody.AppendLine(

strLogBody.AppendLine(HTMLBREAK)

strLogBody.AppendLine(

strLogBody.AppendLine(

strLogBody.AppendLine(

strLogBody.AppendLine(

strLogBody.AppendLine(HTMLBREAK)

strLogBody.AppendLine(

strLogBody.AppendLine(HTMLBREAK)

strLogBody.AppendLine(

strLogBody.Append(Body)

 

SendMail(FromAddress, ToAddress,

SendMail(FromAddress, SentMailLogAddress,

 

 

 

Dim DropzoneName As String = RealDropzone.RDSettings.GetSetting(RealDropzone.RDSettings.Settings.GeneralInfo_DropzoneName, PortalId)" - " & SubjectIf CStr(HostSettings("SMTPServer")) <> "" Then SMTPServer = CStr(HostSettings("SMTPServer"))If CStr(HostSettings("SMTPAuthentication")) <> "" Then SMTPAuthentication = CStr(DotNetNuke.Common.Globals.HostSettings("SMTPAuthentication"))If CStr(HostSettings("SMTPUsername")) <> "" Then SMTPUsername = CStr(HostSettings("SMTPUsername"))If CStr(HostSettings("SMTPPassword")) <> "" Then SMTPPassword = CStr(HostSettings("SMTPPassword"))Dim strLogBody As New System.Text.StringBuilder"RealDropzone Automated Email" & HTMLBREAK)"FromAddress: " & FromAddress & HTMLBREAK)"To Address....:" & ToAddress & HTMLBREAK)"BodyFormat....:" & BodyFormat.ToString & HTMLBREAK)"---------------------------------------------------" & HTMLBREAK)"Subject: " & Subject & HTMLBREAK)"Body:" & HTMLBREAK & HTMLBREAK)Dim strLogSubject As String = "Message Sent: " & Subject"", "", DotNetNuke.Services.Mail.MailPriority.Normal, Subject, Body, BodyFormat, System.Text.Encoding.UTF8, "")"", "", DotNetNuke.Services.Mail.MailPriority.Normal, strLogSubject, strLogBody.ToString, BodyFormat, System.Text.Encoding.UTF8, "")End Sub

 

 

 

SendMail(FromAddress, SentMailLogAddress,

 

Public Shared Sub SendLogRDMail(ByVal MailPriority As MailPriority, ByVal Subject As String, ByVal Body As String, ByVal BodyFormat As MailFormat, ByVal PortalId As String)Dim FromAddress As String = RealDropzone.RDSettings.GetSetting(RealDropzone.RDSettings.Settings.Email_FromAddress, PortalId)Dim SentMailLogAddress As String = RealDropzone.RDSettings.GetSetting(RealDropzone.RDSettings.Settings.Email_SentMailLogAddress, PortalId)"", "", MailPriority, Subject, Body, BodyFormat, System.Text.Encoding.UTF8, "")End Sub

 

 

 

 

 

 

 

 

Public Shared Sub SendMail(ByVal FromAddress As String, _ByVal ToAddress As String, _ByVal AdminAddress As String, _ByVal Priority As MailPriority, _ByVal subject As String, _ByVal body As String, _ByVal BodyFormat As MailFormat)Dim HTMLBREAK As String = ""

 

If BodyFormat = MailFormat.Html Then HTMLBREAK = "<br/>"

 

Dim SMTPServer As String = ""

 

Dim SMTPAuthentication As String = ""

 

Dim SMTPUsername As String = ""

 

Dim SMTPPassword As String = ""

 

' SMTP server configuration

 

 

 

 

DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, ToAddress,

 

If CStr(HostSettings("SMTPServer")) <> "" Then SMTPServer = CStr(HostSettings("SMTPServer"))If CStr(HostSettings("SMTPAuthentication")) <> "" Then SMTPAuthentication = CStr(DotNetNuke.Common.Globals.HostSettings("SMTPAuthentication"))If CStr(HostSettings("SMTPUsername")) <> "" Then SMTPUsername = CStr(HostSettings("SMTPUsername"))If CStr(HostSettings("SMTPPassword")) <> "" Then SMTPPassword = CStr(HostSettings("SMTPPassword"))"", "", Priority, subject, BodyFormat, System.Text.Encoding.UTF8, body, "", SMTPServer, SMTPAuthentication, SMTPUsername, SMTPPassword)If Not String.IsNullOrEmpty(AdminAddress) Then

 

strLogBody.AppendLine(

strLogBody.AppendLine(HTMLBREAK)

strLogBody.AppendLine(

strLogBody.AppendLine(

strLogBody.AppendLine(

strLogBody.AppendLine(

strLogBody.AppendLine(HTMLBREAK)

strLogBody.AppendLine(

strLogBody.AppendLine(HTMLBREAK)

strLogBody.AppendLine(

strLogBody.Append(body)

 

DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, AdminAddress,

 

Dim strLogBody As New System.Text.StringBuilder"RealDropzone Automated Email" & HTMLBREAK)"FromAddress: " & FromAddress & HTMLBREAK)"To Address....:" & ToAddress & HTMLBREAK)"BodyFormat....:" & BodyFormat.ToString & HTMLBREAK)"---------------------------------------------------" & HTMLBREAK)"Subject: " & subject & HTMLBREAK)"Body:" & HTMLBREAK & HTMLBREAK)Dim strLogSubject As String = "Message Sent: " & subject"", "", Priority, subject, BodyFormat, System.Text.Encoding.UTF8, body, "", SMTPServer, SMTPAuthentication, SMTPUsername, SMTPPassword)End If

 

 

End Sub

 

 

 

 

 

 

 

 

 

 

 

 

Private Shared Sub SendMail(ByVal FromAddress As String, _ByVal ToAddress As String, _ByVal CCAddress As String, _ByVal BCCAddress As String, _ByVal Priority As MailPriority, _ByVal Subject As String, _ByVal Body As String, _ByVal BodyFormat As MailFormat, _ByVal BodyEncoding As System.Text.Encoding, _ByVal Attachment As String)Dim SMTPServer As String = ""

 

Dim SMTPAuthentication As String = ""

 

Dim SMTPUsername As String = ""

 

Dim SMTPPassword As String = ""

 

' SMTP server configuration

 

 

 

 

DotNetNuke.Services.Mail.Mail.SendMail(FromAddress, ToAddress, CCAddress, BCCAddress, Priority, Subject, BodyFormat, BodyEncoding, Body, Attachment, SMTPServer, SMTPAuthentication, SMTPUsername, SMTPPassword)

 

If CStr(HostSettings("SMTPServer")) <> "" Then SMTPServer = CStr(HostSettings("SMTPServer"))If CStr(HostSettings("SMTPAuthentication")) <> "" Then SMTPAuthentication = CStr(DotNetNuke.Common.Globals.HostSettings("SMTPAuthentication"))If CStr(HostSettings("SMTPUsername")) <> "" Then SMTPUsername = CStr(HostSettings("SMTPUsername"))If CStr(HostSettings("SMTPPassword")) <> "" Then SMTPPassword = CStr(HostSettings("SMTPPassword"))End Sub

 

End

End Class Namespace

 

 
New Post
1/2/2008 1:34 PM
 

Sahil,

"FROM" can be set, when calling the SendMail, I have not discovered issues with it. DNN ~4.7.0 added support of "ReplyTo", where appropriate.

FYI: I am working on an enhanced Mail implementation for DNN5.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
1/2/2008 9:59 PM
 

guys... i just want to ask if these modules will work with Lotus Notes?

Please advise...

 
New Post
1/3/2008 12:43 AM
 

Thanks Sebastian  for your  interest.  So  can u  expalined  me  about  "ReplyTo" .  And  it's  really  great  that  you  working  on  DNN5.

Bye.  And Thank's  man.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Sending E-mail using custom coding!!!Sending E-mail using custom coding!!!


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out