Home » Developer & Programmer » JDeveloper, Java & XML » send Email using java through internet
send Email using java through internet [message #92090] Sat, 06 March 2004 09:11 Go to next message
Thriuvadi
Messages: 2
Registered: March 2004
Junior Member
I can't able to send mail using java (not with javamail).

If anybody having any idea regarding this please reply to me.

 
Re: send Email using java through internet [message #92157 is a reply to message #92090] Sun, 28 March 2004 18:49 Go to previous messageGo to next message
fadi
Messages: 5
Registered: March 2004
Junior Member
Send me your email && I will send my source code.
send code for email [message #92202 is a reply to message #92157] Fri, 16 April 2004 08:39 Go to previous messageGo to next message
Durga rao
Messages: 1
Registered: April 2004
Junior Member
Hi Sir,

please send me code for sending html based email using java .

Thanks
durga rao
Re: send Email using java through internet [message #92217 is a reply to message #92157] Fri, 23 April 2004 05:03 Go to previous messageGo to next message
jacob
Messages: 6
Registered: October 2000
Junior Member
Hi Sir,

please send me code for sending html based email using java .

Thanks
Jacob
Re: send Email using java through internet [message #92239 is a reply to message #92157] Sat, 01 May 2004 14:58 Go to previous messageGo to next message
Victor Chu
Messages: 2
Registered: May 2004
Junior Member
Can u send me the source code also? my e-mail is vict209130@hotmail.com

Thanks
Re: send Email using java through internet [message #92251 is a reply to message #92239] Wed, 05 May 2004 10:59 Go to previous messageGo to next message
camabr
Messages: 1
Registered: May 2004
Junior Member
Hey I am also trying to send email can you possibly send me a copy of ur code.
Re: send Email using java through internet [message #92252 is a reply to message #92157] Wed, 05 May 2004 22:37 Go to previous messageGo to next message
Pawan
Messages: 33
Registered: June 2002
Member
Please send me Source Code
I just want to Send Mail From Outlook Express
I have call Outlook Exprees by Mailto script

now my mail has to be send to internet
Please Fast .... if possible

pawan gujrathi
Pune
Re: send code for email [message #92255 is a reply to message #92202] Thu, 06 May 2004 08:50 Go to previous messageGo to next message
CARLOS
Messages: 24
Registered: February 2000
Junior Member
Please, could you send me the source code? I have to do without Javamail

Thanks
Re: send Email using java through internet [message #92306 is a reply to message #92217] Wed, 26 May 2004 02:20 Go to previous messageGo to next message
kiran kumar
Messages: 17
Registered: June 2001
Junior Member
please send the code of Email using java through internet
Re: send Email using java through internet [message #92334 is a reply to message #92157] Tue, 08 June 2004 13:42 Go to previous messageGo to next message
Abhishek
Messages: 10
Registered: January 2004
Junior Member
hi abhishek i am ust checking whether this email is working or not
Re: send Email using java through internet [message #92371 is a reply to message #92157] Thu, 17 June 2004 22:26 Go to previous messageGo to next message
parveen
Messages: 3
Registered: May 2004
Junior Member
hi sir
can you please do send me code.i'm in a urgent need.
Parveen
Re: send Email using java through internet [message #92372 is a reply to message #92157] Thu, 17 June 2004 23:42 Go to previous messageGo to next message
parveen
Messages: 3
Registered: May 2004
Junior Member
can you please send me the code .my id is parveen@avesthagen.com
Re: send Email using java through internet [message #92382 is a reply to message #92157] Mon, 21 June 2004 21:00 Go to previous messageGo to next message
Victor Chu
Messages: 2
Registered: May 2004
Junior Member
Send source code for sending Email using java through internet
Re: send Email using java through internet [message #92403 is a reply to message #92382] Thu, 01 July 2004 23:58 Go to previous messageGo to next message
ramendra
Messages: 1
Registered: July 2004
Junior Member
please sende me java source code for sending email
to the internet user
Send Email using java through internet [message #92420 is a reply to message #92157] Thu, 08 July 2004 05:52 Go to previous messageGo to next message
Rohit
Messages: 43
Registered: January 2002
Member
Hi,
How to send an email thru java program.

Thanks & Regards
Rohit
Re: send Email using java through internet [message #92470 is a reply to message #92382] Mon, 02 August 2004 23:54 Go to previous messageGo to next message
Deepak
Messages: 111
Registered: December 1999
Senior Member
/*
Some SMTP servers require a username and password authentication before you
can use their Server for Sending mail. This is most common with couple
of ISP's who provide SMTP Address to Send Mail.

This Program gives any example on how to do SMTP Authentication
(User and Password verification)

This is a free source code and is provided as it is without any warranties and
it can be used in any your code for free.

Author : Sudhir Ancha
*/

import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;

/*
To use this program, change values for the following three constants,

SMTP_HOST_NAME -- Has your SMTP Host Name
SMTP_AUTH_USER -- Has your SMTP Authentication UserName
SMTP_AUTH_PWD -- Has your SMTP Authentication Password

Next change values for fields

emailMsgTxt -- Message Text for the Email
emailSubjectTxt -- Subject for email
emailFromAddress -- Email Address whose name will appears as "from" address

Next change value for "emailList".
This String array has List of all Email Addresses to Email Email needs to be sent to.

Next to run the program, execute it as follows,

SendMailUsingAuthentication authProg = new SendMailUsingAuthentication();

*/

public class SendMailUsingAuthentication
{

private static final String SMTP_HOST_NAME = "myserver.smtphost.com";
private static final String SMTP_AUTH_USER = "deepak";
private static final String SMTP_AUTH_PWD = "mypassword";

private static final String emailMsgTxt = "hi Deepak How are u.";
private static final String emailSubjectTxt = "Checking of Email Program";
private static final String emailFromAddress = "deepak@worldonetel.com";

// Add List of Email address to who email needs to be sent to
private static final String[[]] emailList = {"deepak_thakral007@yahoo.co.in", "deepak_thakral007@rediffmail.com"};

public static void main(String args[[]]) throws Exception
{
SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);
System.out.println("Sucessfully Sent mail to All Users");
}

public void postMail( String recipients[[ ]], String subject,
String message , String from) throws MessagingException
{
boolean debug = false;

//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");

Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);

session.setDebug(debug);

// create a message
Message msg = new MimeMessage(session);

// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);

InternetAddress[[]] addressTo = new InternetAddress[[recipients.length]];
for (int i = 0; i < recipients.length; i++)
{
addressTo[[i]] = new InternetAddress(recipients[[i]]);
}
msg.setRecipients(Message.RecipientType.TO, addressTo);

// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
}

/**
* SimpleAuthenticator is used to do simple authentication
* when the SMTP server requires it.
*/
private class SMTPAuthenticator extends javax.mail.Authenticator
{

public PasswordAuthentication getPasswordAuthentication()
{
String username = SMTP_AUTH_USER;
String password = SMTP_AUTH_PWD;
return new PasswordAuthentication(username, password);
}
}

}
Re: send Email using java through internet [message #92536 is a reply to message #92470] Mon, 06 September 2004 03:03 Go to previous messageGo to next message
fdgf
Messages: 1
Registered: September 2004
Junior Member
this message
Re: send Email using java through internet [message #92634 is a reply to message #92470] Sun, 31 October 2004 20:25 Go to previous messageGo to next message
Venkat
Messages: 110
Registered: February 2001
Senior Member
SMTP checking
Re: send Email using java through internet [message #92652 is a reply to message #92470] Sun, 07 November 2004 23:39 Go to previous messageGo to next message
this cannot work for me
Messages: 1
Registered: November 2004
Junior Member
any messages which i put after this piece of code
' MimeMessage msg = new MimeMessage(session);' are not displayed.

My Smtp username and password are all correct, but dont knw wat the error is. The email cannot be sent.
Re: Send Email using java through internet [message #92678 is a reply to message #92420] Sun, 21 November 2004 08:20 Go to previous messageGo to next message
Hey
Messages: 5
Registered: December 2002
Junior Member
fdsdfsfds
Re: send Email using java through internet [message #92694 is a reply to message #92470] Mon, 29 November 2004 05:00 Go to previous messageGo to next message
Sumit
Messages: 21
Registered: December 2000
Junior Member
hi
Re: send Email using java through internet [message #92714 is a reply to message #92694] Wed, 15 December 2004 01:43 Go to previous messageGo to next message
Debasish Bhadra
Messages: 1
Registered: December 2004
Junior Member
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

// Send a simple, single part, text/plain e-mail
public class TestEmail {

public static void main(String[[]] args) {

// SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
String to = "tabs_4u@yahoo.com";
String from = "Mithun";
// SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
String host = "smtp.clicksaltlake.info";

// Create properties, get Session
Properties props = new Properties();

// If using static Transport.send(),
// need to specify which host to send it to
props.put("mail.smtp.host", host);
// To see what is going on behind the scene
//props.put("mail.debug", "true");
Session session = Session.getInstance(props);

try {
// Instantiatee a message
Message msg = new MimeMessage(session);

//Set message attributes
msg.setFrom(new InternetAddress(from));
InternetAddress[[]] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("Test E-Mail through Java");
msg.setSentDate(new Date());

// Set message content
msg.setText("How are you? " +
"What are you doing?n" +
"Waiting for your reply.n" +
"Byen" +
"Mithun");

//Send the message
Transport.send(msg);
}
catch (MessagingException mex) {
// Prints all nested (chained) exceptions as well
mex.printStackTrace();
}
}
}//End of class
icon5.gif  send Email using java without SMTP server [message #111035 is a reply to message #92470] Sat, 12 March 2005 07:04 Go to previous message
plash
Messages: 1
Registered: March 2005
Junior Member
can i send mail without smtp server(or eny other pop....)
semply with java
Previous Topic: Simple Stored procedure takes 3 minutes to fetch results
Next Topic: java.sql.SQLException: Io exception: Size Data Unit(SDU) mismatchSQL: state
Goto Forum:
  


Current Time: Mon Nov 25 18:05:35 CST 2024