Click here to Skip to main content
13,404,603 members (38,995 online)
Rate this:
 
Please Sign up or sign in to vote.
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 :
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 27-Feb-12 22:06pm
Updated 28-Feb-12 0:10am
v2
Comments
digimanus 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?
digimanus 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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

hi..please try this..
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


<![CDATA[<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Gmail.aspx.vb" Inherits="Gmail" %>]]>
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.1802120.2 | Last Updated 4 Jul 2014
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100