472,102 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

Send Mail Using SMTP

Max
hi

I am using System.Web.Mail.MailMessage with System.Web.Mail.SmtpMail to
send mail. now the my question is,

Is it compulsory to add fields smtpauthenticate, sendusername and
sendpassword fields to MailMessage Object????.

mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1")
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
SMTPEmail)
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
SMTPPassword)

Which fields will i have to add if my SMTP Server doesn't require
authentication.

Sep 6 '06 #1
4 2241
Is it compulsory to add fields smtpauthenticate, sendusername and
sendpassword fields to MailMessage Object????.

mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1")
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
SMTPEmail)
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
SMTPPassword)

Which fields will i have to add if my SMTP Server doesn't require
authentication.
None.
Just try once, and you will see, that the mail will be delivered...

Markus
Sep 6 '06 #2
Max
thanks

Markus wrote:
Is it compulsory to add fields smtpauthenticate, sendusername and
sendpassword fields to MailMessage Object????.

mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1")
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
SMTPEmail)
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
SMTPPassword)

Which fields will i have to add if my SMTP Server doesn't require
authentication.

None.
Just try once, and you will see, that the mail will be delivered...

Markus
Sep 6 '06 #3
You might also take a look at a post I made in response to another question
in this NG under the original posters' subject, "Send email through mapi".

Cheers!

~ Duane Phillips.

"Max" <ma***********@gmail.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
thanks

Markus wrote:
Is it compulsory to add fields smtpauthenticate, sendusername and
sendpassword fields to MailMessage Object????.

mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1")
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
SMTPEmail)
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
SMTPPassword)

Which fields will i have to add if my SMTP Server doesn't require
authentication.

None.
Just try once, and you will see, that the mail will be delivered...

Markus

Sep 6 '06 #4
BTW, ... it was sent 9/6/2006... sorry...

I'll just repost the answer here...

'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'SMTP EMAIL NOTES
'As condensed from: http://www.systemwebmail.com/default.aspx
'1. Have a reference set to the System.Web.dll.
'2. Have "Imports System.Web.Mail" statement at the top of your code.
'3. SmtpMail.SmtpServer must allow relaying for FROM email address or your
IP address,
' or you must use dotNET 1.1 or higher to authenticate.
'SAMPLE SETTINGS
'Dim emlEmail As New System.Web.Mail.MailMessage()
' NOTE: all email addresses can be like: "my********@my-domain.com" - OR -
Fully named like: """John Smith"" <my********@my-domain.com>"
' Also, multiple email addresses can be sent separated by semi-colon
character.
'emlEmail.To = "my********@my-domain.com"
'emlEmail.From = "my********@my-domain.com"
'emlEmail.Cc = "my********@my-domain.com" 'optional
'emlEmail.Bcc = "my********@my-domain.com" 'optional
'emlEmail.Subject = "SUBJECT_HERE"
'emlEmail.BodyFormat = MailFormat.Html
'emlEmail.Body = "BODY OF THE MESSAGE HERE"
'emlEmail.Headers.Add("Reply-To", "my********@my-domain.com")
'Attachments()
'Dim attachment As New System.Web.Mail.MailAttachment("C:\Foo.xls") 'create
the attachment
'emlEmail.Attachments.Add(attachment) 'add the attachment
'Authentication cannot be done using the .NET Framework 1.0. Must use 1.1 or
higher.
'emlEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1") 'basic authentication
'emlEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
"my_username_here") 'set your username here
'emlEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
"super_secret") 'set your password here
'SmtpMail.SmtpServer = "EMAIL_SERVER_DOMAIN" 'your real server goes here
'SmtpMail.Send(emlEmail)
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Watch for text wrapping...

Please note that the above example is for DotNet 1.x
http://www.systemwebmail.com/

To see more information for 2.x, see http://www.systemnetmail.com/

I have found these two sites very useful.

HTH.

Cheers!

~ Duane Phillips.
"Duane Phillips" <du************@askme.askmewrote in message
news:Kv******************************@giganews.com ...
You might also take a look at a post I made in response to another
question in this NG under the original posters' subject, "Send email
through mapi".

Cheers!

~ Duane Phillips.

"Max" <ma***********@gmail.comwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
>thanks

Markus wrote:
>Is it compulsory to add fields smtpauthenticate, sendusername and
sendpassword fields to MailMessage Object????.

mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1")
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
SMTPEmail)
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
SMTPPassword)

Which fields will i have to add if my SMTP Server doesn't require
authentication.

None.
Just try once, and you will see, that the mail will be delivered...

Markus


Sep 6 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tom Petersen | last post: by
6 posts views Thread by John J. Hughes II | last post: by
9 posts views Thread by Bob Jones | last post: by
5 posts views Thread by Andreas | last post: by
4 posts views Thread by =?Utf-8?B?dHBhcmtzNjk=?= | last post: by
7 posts views Thread by oopsbabies | last post: by
8 posts views Thread by shapper | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.