Okay, I've been trying to send an email in a plugin and none of the ways iv'e tried are working (ive also tried using the java-mail API too but that didn't work) so i tried using this email API by Icene: http://forums.bukkit.org/threads/lib-email-send-emails-from-plugins.101927/#post-1882801 and im getting this error when im sending an email: Code:java 02.10 01:55:22 [Server] INFO 530 5.7.0 Must issue a STARTTLS command first. dk3sm9352545pbc.32 - gsmtp02.10 01:55:22 [Server] INFO 502 5.5.1 Unrecognized command. dk3sm9352545pbc.32 - gsmtp02.10 01:55:22 [Server] INFO 502 5.5.1 Unrecognized command. dk3sm9352545pbc.32 - gsmtp02.10 01:55:22 [Server] INFO 530 5.7.0 Must issue a STARTTLS command first. dk3sm9352545pbc.32 - gsmtp02.10 01:55:22 [Server] INFO 250 mx.google.com at your service02.10 01:55:22 [Server] INFO 220 mx.google.com ESMTP dk3sm9352545pbc.32 - gsmtp Here is the code: MailManager: Code:java package me.CMG.EReg.Util; import java.io.DataInputStream;import java.io.DataOutputStream;import java.io.IOException;import java.net.Socket; public class MailManager { private Provider provider;private String owner;private String password; public MailManager(Provider provider, String owner, String password) {this.provider = provider;this.owner = owner;this.password = password;} @SuppressWarnings("deprecation")public void sendEmail(String to, String content, String subject, int port) { String HOST = provider.getHost(); String PASSWORD = Base64Coder.encodeString(password);String USER = Base64Coder.encodeString(owner); try {Socket socket = new Socket(HOST, port); DataOutputStream dos = new DataOutputStream(socket.getOutputStream());DataInputStream is = new DataInputStream(socket.getInputStream()); dos.writeBytes("HELO\r\n");dos.writeBytes("AUTH LOGIN");dos.writeBytes("\r\n");dos.writeBytes(USER);dos.writeBytes("\r\n");dos.writeBytes(PASSWORD);dos.writeBytes("\r\n");dos.writeBytes("MAIL FROM:<" + owner + ">\r\n");dos.writeBytes("\r\n");dos.writeBytes("RCPT TO: <" + to + ">\r\n");dos.writeBytes("DATA\r\n");dos.writeBytes("Subject: " + subject + "\r\n");dos.writeBytes(content);dos.writeBytes("\r\n.\r\n");dos.writeBytes("QUIT\r\n"); dos.flush(); String responseline;while ((responseline = is.readLine()) != null) {System.out.println(responseline);} is.close();dos.close();socket.close();} catch (IOException ex) {System.err.println(ex);}} public void sendEmail(String to, String content, String subject) {sendEmail(to, content, subject, 25); // Use default port} public enum Provider { YAHOO("smtp.mail.yahoo.com"),GMAIL("smtp.gmail.com");private String host; Provider(String host) {this.host = host; } public String getHost() {return host;}} /** Base 64 encoding implementation from [URL]http://www.source-code.biz/base64coder/java/[/URL]*/static class Base64Coder { private static final char[] map1 = new char[64]; static {int i = 0;for (char c = 'A'; c <= 'Z'; c++) {map1[i++] = c;}for (char c = 'a'; c <= 'z'; c++) {map1[i++] = c;}for (char c = '0'; c <= '9'; c++) {map1[i++] = c;}map1[i++] = '+';map1[i++] = '/';}// Mapping table from Base64 characters to 6-bit nibbles.private static final byte[] map2 = new byte[128]; static {for (int i = 0; i < map2.length; i++) {map2[I] = -1;[/I][I] }[/I][I] for (int i = 0; i < 64; i++) {[/I][I] map2[map1[I]] = (byte) i;[/I][/I][I] }[/I][I] }[/I] [I] public static String encodeString(String s) {[/I][I] return new String(encode(s.getBytes()));[/I][I] }[/I] [I] public static char[] encode(byte[] in) {[/I][I] return encode(in, 0, in.length);[/I][I] }[/I] [I] public static char[] encode(byte[] in, int iLen) {[/I][I] return encode(in, 0, iLen);[/I][I] }[/I] [I] public static char[] encode(byte[] in, int iOff, int iLen) {[/I][I] int oDataLen = (iLen * 4 + 2) / 3;[/I][I] int oLen = ((iLen + 2) / 3) * 4;[/I][I] char[] out = new char[oLen];[/I][I] int ip = iOff;[/I][I] int iEnd = iOff + iLen;[/I][I] int op = 0;[/I][I] while (ip < iEnd) {[/I][I] int i0 = in[ip++] & 0xff;[/I][I] int i1 = ip < iEnd ? in[ip++] & 0xff : 0;[/I][I] int i2 = ip < iEnd ? in[ip++] & 0xff : 0;[/I][I] int o0 = i0 >>> 2;[/I][I] int o1 = ((i0 & 3) << 4) | (i1 >>> 4);[/I][I] int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);[/I][I] int o3 = i2 & 0x3F;[/I][I] out[op++] = map1[o0];[/I] [I] out[op++] = map1[o1];[/I][I] out[op] = op < oDataLen ? map1[o2] : '=';[/I][I] op++;[/I][I] out[op] = op < oDataLen ? map1[o3] : '=';[/I][I] op++;[/I][I] }[/I][I] return out;[/I][I] }[/I] [I] private Base64Coder() {[/I] [I] }[/I][I] }[/I][I]}[/I] Sending Email: Code:java MailManager email = new MailManager(Provider.GMAIL, (String)SettingsManager.getManager().getConfig("EReg.Gmail.Email"), (String)SettingsManager.getManager().getConfig("EReg.Gmail.Password"));email.sendEmail(args[0], "Server-Registration", "Your code is: " + ID + " !"); Any ideas on why this is happening? Or is there a efficient way of sending an email (simple one with subject and body)? Really no replies? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
This isn't the right place to ask this question. I am sent emails from a Bukkit plugin before but I doubt you will fine many (if any) other people who have. Emailing in Java is the same whether it is on a Minecraft server or not so you could expand your search to other sites. I used JavaMail myself. You can look at my source at https://github.com/Codisimus/TextPlayer but I haven't touched it in a while.
Thanks but yeah i know its not just in bukkit but ive searched all over google and all of the Tutorials are the same and are all on JavaMail API.
CMG im not going to make out i know this much, but from what i can gather, it may be your base64coder i dont know if its recognisiong that as the tls i havent coded in java for about 10 years so im proberbly way off http://stackoverflow.com/questions/...t-issue-a-starttls-command-first-i16sm1806350 if you havent seen this
Tehmaker JDK Alpha and Beta 1995 and the initial release was sometime in 1996 (From what I remember from books).
Tehmaker Tehmaker sorry tehmaker, just reading and had to point out your "words of knowledge" "1. If you do not know Java, learn it first" lol sorry had to point it out along with java being about 18 years now
Lol haha, I know the language, not its history, and origins. For example, I know how to speak french (fluently), but I do not know its origin, who founded it, what the hell happened to put it here haha.