473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Problem with email sending in asp.net

hi,

i have problem in email sending to 1and1 server...

the error given below

System.Web.HttpException: At least one of the From or Sender fields is required, and neither was found. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8004020D): At least one of the From or Sender fields is required, and neither was found. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.Cal lMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.SmtpMail.LateBoundAccessHelper.Cal lMethod(Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMes sage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at VerveMedia.Mail.VerveMail.Send() in e:\kunden\homepages\37\d230758663\App_Code\VerveMa il.cs:line 151 at RecruiterRegistration.CreateUserWizard1_CreatedUse r(Object sender, EventArgs e) in e:\kunden\homepages\37\d230758663\RecruiterRegistr ation.aspx.cs:line 139 >


Any body can help me very urgent


Thanks
yuvaraj.R
Jan 25 '08 #1
3 3717
debasisdas
8,127 Expert 4TB
What is the code that is throwing this error ?
Jan 25 '08 #2
What is the code that is throwing this error ?

this is the code


using System;
using System.Text;
using System.Web.Mail;

namespace Verve.Mail
{
public class Verve
{
public Verve() { }

string from, to, cc, bcc, subject, body, smtpServerName;



public string From
{
set
{
from = value;
}
}

public string To
{
set
{
to = value;
}
}

public string Cc
{
set
{
cc = value;
}
}

public string Bcc
{
set
{
bcc = value;
}
}

public string Subject
{
set
{
subject = value;
}
}

public string Body
{
set
{
body = value;
}
}


public void Send()
{


// Build HTML Body

StringBuilder sb = new StringBuilder();

sb.Append("<html>");
sb.Append("<head>");
sb.Append("<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>");
sb.Append("<title>just4telecom.com</title>");
sb.Append("<style>");
sb.Append(".ver8 { font-family: Verdana; font-size: 8pt; text-align: justify; line-height: 200% }");
sb.Append("</style>");
sb.Append("</head>");
sb.Append("<body link='#1865AD' vlink='#1865AD' alink='#1865AD'>");
sb.Append("<table border='0' cellpadding='0' cellspacing='0' width='100%' id='table1'>");
sb.Append("<tr>");
sb.Append("<td align='center' valign='top'>");
sb.Append("<table border='0' cellpadding='0' cellspacing='0' width='85%' id='table2'>");
sb.Append("<tr>");
sb.Append("<td></td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td>");
sb.Append("<img border='0' src='http://just4telecom.com/images/just4telecom.jpg'></td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td><hr noshade size='1' color='#E9E9E9'></td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td></td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td class='ver8'></td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td class='ver8'>" + body + "</td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td class='ver8'></td>");
sb.Append("</tr>");
sb.Append("<tr>");
sb.Append("<td></td>");
sb.Append("</tr>");
sb.Append("</table>");
sb.Append("</td>");
sb.Append("</tr>");
sb.Append("</table>");

sb.Append("</body>");

sb.Append("</html>");

MailMessage objMail = new MailMessage();

if (from == null)
{
from = "info@just4telecom.com";
}
else
{
objMail.From = from;
}
objMail.To = to;

if (cc != null)
{
objMail.Cc = cc;
}

if (bcc != null)
{
objMail.Bcc = bcc;
}
if (subject == null)
{
Subject = "Resume to just4telecom.com";
}

objMail.Subject = subject;
objMail.BodyFormat = MailFormat.Html;
objMail.Body = sb.ToString();
objMail.Priority = MailPriority.Normal;
SmtpMail.SmtpServer = "smtp.1and1.com";
SmtpMail.Send(objMail);
}
}
}
Jan 25 '08 #3
harshmaul
490 Expert 256MB
If you server needs to go through a proxy to access a remote smtp server you might need to give the code proxy settings.....

strWebProxy = "123.123.123.123:8080";
strProxyUser = "user";
strProxyPassword = "password";

WebProxy p = new WebProxy(strWebProxy, true);
p.Credentials = new NetworkCredential(strProxyUser, strProxyPassword);
GlobalProxySelection.Select = p;
Jan 25 '08 #4

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

Similar topics

3
by: Serge Myrand | last post by:
Hi everybody, The following code for sending email (found on msn I think) works find when used in a .VBS file. I double click the file and the mail is send. When I use the same code in my .ASP...
2
by: Eric Timely | last post by:
After a trust with exchange server established the xp_SendMail gives the following error: xp_sendmail: failed with mail error 0x80070005 Prior to the trust everything worked fine. I have...
6
by: Mike the Canadian | last post by:
I am having a very strange problem sending email with php. I have two domains. I can send an email to one domain using php but not the other. If I put both email addresses in the mail command only...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
5
by: Mark A. Sam | last post by:
Hello, I am sending two emails from the same procedure, one to myself (while testing) and another (a comfirmation) to the user on the website. I was having difficulty finding a relay server to...
2
abdoelmasry
by: abdoelmasry | last post by:
Hi men i have big problem with microsoft exchange server 2003 i installed exchange server as main mail server to use it on in company i have static real ip address im sending and...
3
crystal2005
by: crystal2005 | last post by:
I found such eror message when i tried to test sending email. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in...
28
tdw
by: tdw | last post by:
Hi all, I am trying to add a feature to our database that automates sending emails. When entering a new order, I want the option to send an email to the company the order came from, attaching a...
5
by: wktarin | last post by:
Hi. I'm a relative newcomer to the world of php, and I keep bumping into a problem with a mail () form. I need to send an automatic email to two addresses, but I can't seem to get it to work. One...
0
Dormilich
by: Dormilich | last post by:
this is a follow-up thread to this one. http://bytes.com/topic/html-css/answers/863662-form-not-submitted-sometimes I figured out that the mail sending class triggers the described error....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.