Click here to Skip to main content
14,975,556 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hey guys.
I need a help on sending email using VB.NET without having installed SMTP server/IIS.
I tried using System.Net.Mail namespace to send Email, but its not working. I get the error :
VB
554,Transaction failed,Sender <xxxx@companyaaa.com> rejected.
I dont want to install SMTP server/IIS. I wonder how this outlook works, I have configured my outlook with my email settings and it works. But not in VB.NET.
Assume I have the settings in Outlook as follows :
Email Addres : ABC@companyAAA.com
Server Info >
Account Type: POP3
Incoming Mail Server: secure.webemail.com
Outgoing Mail Server: secure.webemail.com
Username : ABC@companyAAA.com
password : 123456

Outlook > More Settings >
Incoming Port(POP3):110
Outgoing Port(SMTP):25

Is there any method to send email using above settings? Also someone please explain me how this outlook works without SMTP?
Thanks.
Posted
Updated 27-Feb-12 23:10pm
v2
Comments
Herman<T>.Instance 28-Feb-12 3:26am
   
which security settings your current smrp server uses? Do you use credentails?
tonydsouza1987 28-Feb-12 4:23am
   
Yes I use credentials. I used Net.NetworkCredential to supply credentials. It doesnt work. Then I came to know that I need to install SMTP. But is it possible to send email without Installing SMTP component?
Herman<T>.Instance 28-Feb-12 5:11am
   
is the outgoing port 25 or another one?
tonydsouza1987 28-Feb-12 5:49am
   
25.
Simon_Whale 28-Feb-12 6:19am
   
Each Email hosting company will require you to send mail through their severs in a particular way, I would suggest that you contact them and find out what they need you to do for it too happen.

As I have done something similar before and one provider required me to use a sercure authsmtp server and another provider requires you to just send it to them with a valid user name a password.

Hey digimanus,
Sorry for bothering you on this. It was my mistake I had given passwd wrong.
I think we dont need SMTP/IIS windows feature installed to work this.
I got it working without SMTP installed.
'ABC@companyAAA.com > My email ID
'XYZ@(companyAAA.com > recepient)
'secure.webemail.com > Incoming Mail server/Outgoing Mail server as configured in outlook.
Dim emailMsg As New MailMessage("ABC@companyAAA.com", "XYZ@companyAAA.com", "Subject", "Body")
Dim smtpclnt As New SmtpClient("secure.webemail.com", 25)
smtpclnt.Credentials = New Net.NetworkCredential("ABC@companyAAA.com", "123456")
smtpclnt.EnableSsl = True
Try
    smtpclnt.Send(emailMsg)
Catch ex As SmtpException
    MessageBox.Show(ex.ToString)
    Exit Sub
End Try
MessageBox.Show("Email sent succesfully")


Thank you for your conern.
   
hi..please try this..
VB
Imports System.Net.Mail
Partial Class Gmail
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click1(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim mail As MailMessage = New MailMessage()
        mail.To.Add(TextBox1.Text)
       mail.From = New MailAddress("YourGmailID@gmail.com")
        mail.Subject = "hi"
        mail.Body = TextBox2.Text
        mail.IsBodyHtml = True
        Dim smtp As SmtpClient = New SmtpClient()
        smtp.Host = "smtp.gmail.com"
        smtp.Credentials = New System.Net.NetworkCredential("venkatmca008@gmail.com", "yourpassword")
        smtp.EnableSsl = True
        smtp.Send(mail)
    End Sub
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    End Sub
End Class


]]>
   
Comments
Member 11129380 29-Jul-20 3:21am
   
Failure sending mail.
{"Failure sending mail."}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900