473,690 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send mail on yahoo, hotmail

62 New Member
Hello All,

I want to send mail through asp.net to other my company domain e.g yahoo, hotmail etc
Code is as below

////Start Code////////
Expand|Select|Wrap|Line Numbers
  1. Imports System.Net.Mail
  2.  Dim MailMessage As MailMessage = New MailMessage
  3.  
  4.         MailMessage.From = New System.Net.Mail.MailAddress   ("DO_NOT_REPLY@QHSE.COM")
  5.  
  6.         MailMessage.To.Add(New MailAddress("abc@hotmail.com"))
  7.  
  8.         MailMessage.Subject = "Subject"
  9.  
  10.         MailMessage.Body = "Body"
  11.  
  12.         Dim SmtpClient As SmtpClient = New SmtpClient
  13.  
  14.         SmtpClient.Host = "es10" ' my email server
  15.         SmtpClient.Port = 25
  16.  
  17.         Try
  18.             SmtpClient.Send(MailMessage)
  19.  
  20.         Catch ex As Exception
  21.             Response.Write(ex.Message)
  22.         End Try
////////////End Code///

But it returns error message as below.

Transaction failed. The server response was: Relay rejected for policy reasons.

Note: when i send email to my company adress through this code it work properly.

Any one can help

Thanks
Jul 8 '09 #1
2 6773
Frinavale
9,735 Recognized Expert Moderator Expert
Is your mail server configured to allow outbound emails?
Jul 8 '09 #2
Curtis Rutland
3,256 Recognized Expert Specialist
I don't believe that Hotmail or Yahoo will let you use their relays.

You might try providing your login credentials to the SMTP server though. It may work.

Before I give you this code sample, I have to say that using a Class name for an instance name is just plain crazy. You made an SmtpClient object called SmtpClient. How do you know which you are referring to, the instance, or the class? Change the name to something else, like this maybe:

Expand|Select|Wrap|Line Numbers
  1. Dim MailServer As SmtpClient = New SmtpClient
  2. MailServer.Credentials = new System.Net.NetworkCredential("username", "password")
Jul 9 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
5062
by: erdem kemer | last post by:
i cant send mail to yahoo mail or hotmail while i can send my other mail accounts (pop3) is it becouse yahoo and hotmail is web-based mail here is the code MailMessage mailMsg = new MailMessage(); mailMsg.From = from; from = from + from;
4
3791
by: PawelR | last post by:
Hi, everbody. How send e-mail if smtp need authorization. If authorization is not required send email is not problem but I use SmtpMail.Send(myMail) PawelR
14
9129
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
13
5211
by: stam | last post by:
hello guys, i have met a problem that i can send the html e-mail by using MIME via php to yahoo mail and hotmail, but when i was try to send to gmail, it show all the html coding. can someone help me to solve this kind of problem? thank you the coding i made----->: <?php $a=<<<A
5
1477
by: fanor | last post by:
I have a windows aplication and i would like to send email. Does anyone one know what is the yahoo server??? TIA PD: my aplication is in VS 2005 and c#.
1
3187
by: oliu321 | last post by:
Hi, I am trying to write some codes to send emails through a SMTP server. I wrote a C++ version using pure socket programming and SMTP protocol, a VB version using CDO and a C# version using System.Net.Mail. Now all of them works great with any email account but hotmail. So here is the C# code: MailAddress from = new MailAddress("ZZZ@CCC.com", "XXX"); MailAddress to = new MailAddress("SSS@hotmail.com", "YYY");
3
1655
by: Dave | last post by:
I am trying to write code to help me send an email. I have the email address to sent to, stored in a database. I've read several articles and I'm not sure what is meant by placing "yourmailserver" as a value. I plan to distribute this program to several users. They could be using Yahoo, Hotmail, POP 3 or SMTP. So I cannot hardcode the mailserver name. Is there some generic mailserver? I have seen some use of localhost as mail server. Is...
0
6312
by: jlconde | last post by:
I have a classe to send mails. It runs on yahoo well but with hotmail I never receive the mails.I do not receive an error neither. I would need some strange header to make the hotmail like my email???? My code is: import java.net.*; import java.io.*; import java.util.*;
0
1726
by: Roba roro | last post by:
hi , i'm trying to sned a mail in my web (ASP.NET) ,i want to be able to send mails to my clients who have hotmail yahoo or gmail accounts....from different accounts also .... in web.config <system.net> <mailSettings> <smtp from="" deliveryMethod="network"> <network host="smtp.sigorta-online.com" port="25" defaultCredentials="true" /> </smtp>
0
8531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8793
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6457
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4322
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4550
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.