Error in sending mail to Gmail :-(
Hi,
I am trying to send mail to gmail from my program but I am getting the following error.......Please suggest the solution and cause of problem.
Prog:_
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class Mail {
public static void main(String[] args) throws Exception{
Properties props = new Properties();
String mailMessage="ur friend Here";
props.put("mail.smtp.host","smtp.Gmail.com");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("[email protected]");
message.setFrom(from);
InternetAddress to = new InternetAddress("[email protected]");
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("It is Urgent....");
message.setContent(mailMessage, "text/html");
Transport.send(message);
System.out.println("sent");
O/P_
Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0
Must issue a STARTTLS command first i6sm12879368wxd.21
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1515)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1054)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:634)
at javax.mail.Transport.send0(Transport.java:189)
at javax.mail.Transport.send(Transport.java:118)
at Mail.main(Mail.java:31)
Thanks
Deviprasad
Hi,
I tried with props.put("mail.smtp.starttls.enable","true"); but the following error message
Exception in thread "main" javax.mail.MessagingException: Exception reading resp
onse;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1611)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1369)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:288)
at javax.mail.Service.connect(Service.java:169)
at javax.mail.Service.connect(Service.java:118)
at javax.mail.Transport.send0(Transport.java:188)
at javax.mail.Transport.send(Transport.java:118)
at Mail.main(Mail.java:31)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:88)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java
:1589)
... 8 more
Plz help....
Similar Messages
-
Script task fails to send mail to GMAIL
Hi guys ,
I am new here and i am glad i that i am here. I am working in a company as SQL Server developer(T-sql), i am learning SSIS because i wanted to move to data warehousing.
I not familiar and i don't know any thing about C#, but i am learning SSIS on my own.
I tried to send mail to gmail using script task , both sender and receiver with same mail ID using variables which i tried using tutorial i found from the below link.
[quote]http://www.codeproject.com/Articles/85172/Send-Email-from-SSIS-with-option-to-indicate-Email[/quote]
but finally when i execute the task , it returns failure message and email is not sent.
[quote]SSIS package "Send mail using script task.dtsx" starting.
Error: 0x8 at Script Task: The script returned a failure result.
Task failed: Script Task
SSIS package "Send mail using script task.dtsx" finished: Success.
[/quote]
Below message taken from progress tab
[quote]Error: The script returned a failure result.[/quote]
Can you all please help me in finding where i am going wrong? please check below code which i have used in script task.
Microsoft SQL Server Integration Services Script Task
Write scripts using Microsoft Visual C# 2008.
The ScriptMain is the entry point class of the script.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Net.Mail;
namespace ST_9bc84810a62a401aa44ddd905bcd369d.csproj
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
#region VSTA generated code
enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
#endregion
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
public void Main()
string sSubject = "Test Subject";
string sBody = "Test Message";
int iPriority = 2;
if (SendMail(sSubject, sBody, iPriority))
Dts.TaskResult = (int)ScriptResults.Success;
else
//Fails the Task
Dts.TaskResult = (int)ScriptResults.Failure;
public bool SendMail(string sSubject, string sMessage, int iPriority)
try
string sEmailServer = Dts.Variables["sEmailServer"].Value.ToString();
string sEmailPort = Dts.Variables["sEmailPort"].Value.ToString();
string sEmailUser = Dts.Variables["sEmailUser"].Value.ToString();
string sEmailPassword = Dts.Variables["sEmailPassword"].Value.ToString();
string sEmailSendTo = Dts.Variables["sEmailSendTo"].Value.ToString();
string sEmailSendCC = Dts.Variables["sEmailSendCC"].Value.ToString();
string sEmailSendFrom = Dts.Variables["sEmailSendFrom"].Value.ToString();
string sEmailSendFromName = Dts.Variables["sEmailSendFromName"].Value.ToString();
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress(sEmailSendFrom, sEmailSendFromName);
//You can have multiple emails separated by ;
string[] sEmailTo = Regex.Split(sEmailSendTo, ";");
string[] sEmailCC = Regex.Split(sEmailSendCC, ";");
int sEmailServerSMTP = int.Parse(sEmailPort);
smtpClient.Host = sEmailServer;
smtpClient.Port = sEmailServerSMTP;
System.Net.NetworkCredential myCredentials =
new System.Net.NetworkCredential(sEmailUser, sEmailPassword);
smtpClient.Credentials = myCredentials;
message.From = fromAddress;
if (sEmailTo != null)
for (int i = 0; i < sEmailTo.Length; ++i)
if (sEmailTo[i] != null && sEmailTo[i] != "")
message.To.Add(sEmailTo[i]);
if (sEmailCC != null)
for (int i = 0; i < sEmailCC.Length; ++i)
if (sEmailCC[i] != null && sEmailCC[i] != "")
message.To.Add(sEmailCC[i]);
switch (iPriority)
case 1:
message.Priority = MailPriority.High;
break;
case 3:
message.Priority = MailPriority.Low;
break;
default:
message.Priority = MailPriority.Normal;
break;
//You can enable this for Attachments.
//SingleFile is a string variable for the file path.
//foreach (string SingleFile in myFiles)
// Attachment myAttachment = new Attachment(SingleFile);
// message.Attachments.Add(myAttachment);
message.Subject = sSubject;
message.IsBodyHtml = true;
message.Body = sMessage;
smtpClient.Send(message);
return true;
catch (Exception ex)
return false;
Please help me resolve this guys ... THANKS IN ADVANCEThank you very much for your reply @Elvis Long,
Sorry for the late reply
Actually, i am not trying or executing this task from my office , but i am trying this at my home :( .
sEmailPort has value 587 sEmailServer has smtp.gmail.com
Can you please check whether this C# coding is correct or not ? because finally it gives error saying "Script
Task: The script returned a failure result"
so can you please check this with your system and let me know what is wrong with this code
Thanks in advance -
Java mail api - sending mails to gmail account
Hello
I am using java mail api to send mails.when i send mails to gmail from ids which are not in gmail friends list, most of the mails are going to spam.Ofcourse, some of them go to inbox.I tried in lot of ways to analyse the problem.But nothing could help. Can anyone plzz tell me how to avoid mails going to spam in gmail, using java mail api?
Thank you in advance,
Regards,
Aradhana
Message was edited by:
Aradhanaam using the below code.
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port","25");
props.put("mail.smtp.auth", isAuth);
Authenticator auth = new UserAuthenticator();
// Get session
Session s = Session.getDefaultInstance(props,auth);
// Define message
Message m = new MimeMessage(s);
// setting message attributes
try {
m.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
InternetAddress f_addr=new InternetAddress(from);
f_addr.setPersonal(personalName);
m.setFrom(f_addr);
m.setSubject(subject);
m.setSentDate(new Date());
m.setContent(msg,"text/plain");
m.saveChanges();
// send message
Transport.send(m);
Message was edited by:
Aradhana -
Error while sending mail from SAP
Hello All,
Recently we are facing an error while sending mail from SAP. When we try to compose a message ,it is moving to a dump error RAISE_EXCEPTION.
The details from ST22,
Short text
Exception condition "FOLDER_NOT_EXIST" raised.
Error analysis
A RAISE statement in the program "SA
condition "FOLDER_NOT_EXIST".
Since the exception was not intercep
program, processing was terminated.
Kindly suggest..
Thank You,
Regards,
HasanHello Priyanka,
Actually, I performed the following two steps in order to solve the issue:
- In transaction SICF, the node for SAPConnect must be active. In our system, this node was in inactive state. Hence I activated it.
- Then In transaction SCOT-> Settings menu--> default domain should be 'xyz.com' if the email addresses in your company are maintained with a suffix xyz.com.
But for me the problem didnt get solved here..
The problem that i am facing now is that if in my user profile, I have the email address maintained, then i get an error saying 'Sender address rejected'. However, if i goto transaction SU01 and clear the email id, the mail is successfully sent to outer world.
You can try the above mentioned two steps using SICF and SCOT. If the problem does not get solved then try clearing the mail id in ur user profile.
Hope this helps. If you find an answer to the problem of the mail id getting cleared, then please let me know..
Regards,
Himanshu -
Error in sending mail using ssl server
Hi All
Please help in resolving the below issue i am getting the following error while sending mail. I am using the IMAP server and it is ssl configured.
DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "mail.test.com", port 465, isSSL true
DEBUG SMTP: exception reading response: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: subject/issuer name chaining check failed
javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: subject/issuer name chaining check failed
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at com.test.test.JavaMailApp2.main(JavaMailApp2.java:59)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: subject/issuer name chaining check failed
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
... 4 more
Caused by: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: subject/issuer name chaining check failed
at sun.security.validator.PKIXValidator.doValidate(Unknown Source)
at sun.security.validator.PKIXValidator.doValidate(Unknown Source)
at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
at sun.security.validator.Validator.validate(Unknown Source)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(Unknown Source)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
... 17 more
Caused by: java.security.cert.CertPathValidatorException: subject/issuer name chaining check failed
at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(Unknown Source)
at sun.security.provider.certpath.PKIXCertPathValidator.doValidate(Unknown Source)
at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(Unknown Source)
at java.security.cert.CertPathValidator.validate(Unknown Source)
... 24 moreBelow is the source code of the program.
package com.test.test;
import java.security.Security;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class JavaMailApp {
public static void main( String[] args )
String d_email = "[email protected]";
String d_uname = "ots.support";
String d_password = "password";
String d_host = "mail.test.com";
String d_port = "465"; //465,587
String m_to = "[email protected]";
String m_subject = "Testing";
String m_text = "Hey, this is the testing email.";
Properties props = new Properties();
props.put("mail.smtp.user", d_email);
props.put("mail.smtp.host", d_host);
props.put("mail.smtp.port", d_port);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.debug", "true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.socketFactory.port", d_port);
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
SMTPAuthenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
session.setDebug(true);
MimeMessage msg = new MimeMessage(session);
try {
msg.setText(m_text);
msg.setSubject(m_subject);
msg.setFrom(new InternetAddress(d_email));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
Transport transport = session.getTransport("smtps");
transport.connect(d_host, 465, d_uname, d_password);
transport.sendMessage(msg, msg.getAllRecipients());
transport.close();
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public class SMTPAuthenticator extends Authenticator{
public PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication("[email protected]", "password");
}I have also added the certificate to my keystore using the following command and still i am facing this issue.
keytool -import -trustcacerts -alias root -file mail_test_com.crt -keystore keystore.jks
Add to fierof2's Reputationthis is where i created the keystore.jks file
I navigated to the location C:\Program Files\Java\jdk1.6.0_13\bin in command prompt and typed the following command to create the keystore
keytool -import -trustcacerts -alias root -file mail_test_com.crt -keystore keystore.jksI was asked to set the password for keystore and then i was asked the question "Trust this certificate? [no]:" for which i gave yes.
If this is not the right place to create the keystore.jks can you please tell me what is correct location to create the keystore file. -
Hi, I am receiving emails but whenever I try and send I get the following message:
unable to send emails An error occurred sending mail: The mail server sent an incorrect greeting: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready..What are your settings in Tools(or AppMenu/Options)/Account Settings/Outgoing Server (SMTP)? The error message suggests you must have STARTTLS connection security and normal password authentication:
https://getsatisfaction.com/mozilla_messaging/topics/mail_preferences-t1xeq -
Urgent:-REP-50152: Error while sending mail
hi
i am using reports10g. i have called a report from a form and destype=mail.
i have already mention the smtp server name in conf. file but still receiving this error
REP-50152: Error while sending mail - Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
thanksYour smtp server forbids relaying, which is very common. Often a smtp server is configured to send only mails within the same domain without authentication. Otherwise, you need a username and password for the smtp server. I'm not sure if you can configure Reports to send mail through an authenticated server.
-
Terminated with error: REP-50152:Error while sending mail
Hi
Gets this error while sending report mails to external email id's
Terminated with error: REP-50152: Error while sending mail - Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
Any setting to be done in report config file?
thanks
MGIt should be like this
<pluginParam name="mailServer">%MAILSERVER_NAME%</pluginParam>
Specify the name of your mail server in the place of %MAILSERVER_NAME% above
Also make sure that this is not commented out.
Thanks, -
Error Occurred while sending mail through gmail account
Hello,
I am writing 1 demo appln which will send a mail from my gmail account. It will show error like "javax.mail.MessagingException: 530 5.5.1 Authentication Required f77sm3109311pyh"
Here is Code : -
package demo;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Demo {
* @param args
public static void main(String[] args) {
try
Properties properties=System.getProperties();
properties.put("mail.smtp.host","smtp.gmail.com");
properties.put("mail.smtp.auth","true");
properties.put("mail.from","[email protected]");
properties.put("mail.smtp.port","465");
properties.put("mail.smtp.starttls.enable","true");
properties.put("mail.smtp.socketFactory.port", "465");
properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
properties.put("mail.smtp.socketFactory.fallback", "false");
Authenticator auth = new PopupAuthenticator();
Session session = Session.getDefaultInstance(properties,auth);
session.setDebug(true);
// Define message
MimeMessage message = new MimeMessage(session);
message.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
message.setSubject("Hello JavaMail");
message.setText("Welcome to JavaMail");
message.saveChanges();
Address address[] = message.getAllRecipients();
Address a1 = address[0];
System.out.println("Recipient : "+a1.toString());
Transport.send(message, message.getAllRecipients());
catch(Exception e){e.printStackTrace();}
and code for PopupAuthenticator :-
package demo;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.swing.*;
import java.util.StringTokenizer;
public class PopupAuthenticator extends Authenticator
public PopupAuthenticator()
System.out.println("In Auth");
public PasswordAuthentication getPasswordAuthentication()
String username, password;
String result = JOptionPane.showInputDialog("Enter 'username,password'");
StringTokenizer st = new StringTokenizer(result, ",");
username = st.nextToken();
password = st.nextToken();
return new PasswordAuthentication(username, password);
But when i run this code i never get popup window asking for username/password and it throws follwing exception
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 530 5.5.1 Authentication Required f77sm3109311pyh
at javax.mail.Transport.send0(Transport.java:204)
at javax.mail.Transport.send(Transport.java:88)
at demo.Demo.main(Demo.java:66)
may i know wats wrong wid my code? I am confussed about when getPasswordAuthentication () method will call?
please reply me at [email protected]
thnx in advance ..
-SushrutHi bshannon ,
Thnx ..
I have removed the popup code from my PopUpAuthanticer.java file
But i got similar error ....
Here is Debug message : -
In Auth
Recipient : [email protected]
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG: SMTPTransport trying to connect to host "smtp.gmail.com", port 465
DEBUG SMTP RCVD: 220 mx.google.com ESMTP y78sm4251719pyg
DEBUG SMTP SENT: helo sushrutr
DEBUG SMTP RCVD: 250 mx.google.com at your service
DEBUG: SMTPTransport connected to host "smtp.gmail.com", port: 465
DEBUG SMTP SENT: mail from: <[email protected]>
DEBUG SMTP RCVD: 530 5.5.1 Authentication Required y78sm4251719pyg
DEBUG SMTP SENT: quit
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 530 5.5.1 Authentication Required y78sm4251719pyg
at javax.mail.Transport.send0(Transport.java:204)
at javax.mail.Transport.send(Transport.java:88)
at demo.Demo.main(Demo.java:53)
can u please tell me when getPasswordAuthentication() will call ? and who is going to call this ...
Thnx in advance ... -
Error while sending mail using script task in ssis 2008
Hi,
i am trying to send mail using ssis 2008 script task.for my requirement i am not able to use send mail task.
code i have used is
declared read only variables system::packagename
Dim PACKAGE As String
PACKAGE = Dts.Variables("System::PackageName").Value.ToString()
Dim myHtmlMessage As MailMessage
Dim mySmtpClient As SmtpClient
myHtmlMessage = New MailMessage("[email protected]", "[email protected]", "PACKAGE STATUS", PACKAGE + "WAS FAILED")
mySmtpClient = New SmtpClient("smtp.gmail.com")
mySmtpClient.Credentials = New NetworkCredential("[email protected]", "mypassword")
mySmtpClient.EnableSsl = True
mySmtpClient.Port = 587
mySmtpClient.Send(myHtmlMessage)
error i am getting is
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
Authentication Required. Learn more at
at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at ST_c121e07caaa94c21bb1355d4f753112f.vbproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
can any one tell me where i am going wrongalso getting error as follows
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1
Authentication Required. Learn more at
at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at ST_c121e07caaa94c21bb1355d4f753112f.vbproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript() -
Error while sending mail in RDI Format
Hi All
I have a requirement automate sending of invoices customers via fax and e-mail in RDI format.
For this I created a from and used the parameter raw_data_interface = 'X' for this and for sending mail filled the parameters MAIL_SENDER and MAIL_RECIPIENT for sending a mail, used device as 'MAIL'.
When I run the program i get the error "No Output Device Defined". Could you please tell where the issue is.
Best Regards,
Pradeep.hi,
i am having one prob...
how to send a alv report to external mail id....like gmail,yahoo etc....
can u send me the code..
Pls........ -
Can't send mail using gmail in Mail 2.1.3 (OSX 10.4.11)
Hi, it seems like I can receive mail but I get the following error message when I try to send mail:
Cannot send message using the server (null)
The server response was: 5.7.0 From address is not one of your address
I did set up the account information for outgoing mail server (smtp): smtp.gmail.com: username
CAn anyone help me?Hi, did you set up according to these Standard instructions:
http://mail.google.com/support/bin/answer.py?hl=en&answer=13287
Especially the...
Please note that if your client does not support SMTP authentication, you won't be able to send mail through your client using your Gmail address.
Also, if you're having trouble sending mail but you've confirmed that encyrption is active for SMTP in your mail client, try to configure your SMTP server on a different port: 465 or 587. -
Can't send mail - says gmail server can't be found? was fine yesterday
mac air wont send mail - says it cant connect the gmail server?
it is also showing error 54:conection reset by peer ??
-
Problem in Sending mail thru gmail........
i am new to Java mail API,can any one help me out...
i have gmail a/c named [email protected] and it is smtp enabled.
now i want to send mail from my application.so, i write the following code....but it give some error as describe follow.....
/**************** Code **************/
package mailsend;
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
Mahesh Dave. 9960497637
public class Main {
static String msgText1 = "This is a message body.\nHere's line two.";
static String msgText2 = "This is the text in the message attachment.";
/** Creates a new instance of Main */
public Main() {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
String to = "[email protected]";
String from = "[email protected]";
String host = "smtp.gmail.com";
boolean debug = Boolean.valueOf(false).booleanValue();
// create some properties and get the default Session
Properties props = new Properties();
props.put("mail.smtp.host", host);
Session session = Session.getInstance(props, null);
session.setDebug(debug);
try
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("JavaMail APIs Multipart Test");
msg.setSentDate(new Date());
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(msgText1);
// create and fill the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// Use setText(text, charset), to show it off !
mbp2.setText(msgText2, "us-ascii");
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
// send the message
Transport.send(msg);
catch (MessagingException mex)
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null)
ex.printStackTrace();
/*************** Error **************/
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Administrator\My Documents\MailSend\build\classes
compile:
run:
javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(Session.java:768)
at javax.mail.Session.getTransport(Session.java:708)
at javax.mail.Session.getTransport(Session.java:651)
at javax.mail.Session.getTransport(Session.java:631)
at javax.mail.Session.getTransport(Session.java:686)
at javax.mail.Transport.send0(Transport.java:166)
at javax.mail.Transport.send(Transport.java:98)
at mailsend.Main.main(Main.java:81)
BUILD SUCCESSFUL (total time: 7 seconds)
So can any one help to solve above probs........and also i want to made atachement inform of file.....anyone have any idea about this, can help.....
Thank you in advance.....You've read the JavaMail FAQ, right? If not, please do now.
You've also found and tried the many sample programs that
come with JavaMail, right?
javax.mail.NoSuchProviderException: smtp
This error is often a result of not using mail.jar directly but instead extracting
the classes from mail.jar and adding them to your application. Don't do that.
If that's not what you did, I need more information about your environment,
such as your CLASSPATH setting. -
Receiving bogus error message sending mail
Hello all,
I've configured an Exchange ActiveSync account on my iPhone 3GS to connect to my IceWarp mail server (I turned SSL off btw).
It connects fine, my IMAP folders sync beautifully and I can receive mail without any problems.
However, when I attempt to send mail using this account (either to an external address such as GMail or an address on our mail server) I get the following error message:
"Cannot Send Mail: An error occurred while delivering this message"
Then the message sits in my outbox.
HOWEVER... here's the kicker...
I actually receive the e-mail without any problems on my GMail account (or my own internal account I sent the test message to).
I don't know what's causing this incorrect error message to appear, but it's starting to drive me insane.
Any help on this would be greatly appreciated.
Thanks!If anyone was still interested, the issue has been resolved.
It turns out, the iPhone was attempting to create a "Sent" folder and the mail server was claiming that the name was invalid. The server had a folder named "Sent Items" already on it to store the sent e-mails.
I re-named the "Sent Items" folder on the server to "Sent" and everything was fixed.
Maybe you are looking for
-
IPod Classic 80gb SLOW in iTunes
Just wanted to add my voice to the growing number of people complaining that their new iPod Classics are causing iTunes to freeze, crash, not respond, etc. I got mine yesterday, an 80gb one, and after a four hour synch I assumed the slowness I experi
-
PDF Bookmarks - Change Default Width When Creating PDF File from InDesign
When creating a PDF file (from Indesign CS4) I automatically create the PDF bookmarks based on the InDesign document's Table of Contents. But by default the width in the bookmarks is always set at "Fit Page". Is there a way to change the default to "
-
[JS] [CS3] Getting references of items
Hi I am working with an InDesign file that has been built with an applescript. The page contains a mixture of text and image frames, drawn in a grid style (see attached). I need to somehow be able to toggle through each item, and get a reference on
-
Movies on photo album page not working correctly
I have movies on some photo album pages, and only since updating to Snow Leopard, when I click on a movie, the sound begins to play, but the picture sticks on the poster frame. If I go "back to album" and click the movie again, it will usually play n
-
Why is App Store missing?
I am trying to download Lion on my Mac ... but I cannot access the App Store. There is no icon on my computer, and I can't find it in applications or anywhere on the computer. I have updated the software, as per instructions. What next? I have alread